Fixed a bug in AIR

This commit is contained in:
Yessiest 2022-05-21 21:31:14 +04:00
parent b4d0f9ea54
commit 07501e7fa0
2 changed files with 35 additions and 1 deletions

View File

@ -1,6 +1,7 @@
--rewrite this lib (P.S: done)
--P.S: air stands for Advanced Input Recognition, although technically it's not all that advanced
local parse_string = require("string_parse")
local table_utils = require("table-utils")
air = {}
object_types = {
["voiceChannel"] = function(id,client,guild_id)
@ -105,7 +106,7 @@ object_types = {
air.parse = function(string,argmatch,client,guild_id)
local strings = parse_string(string,"[\"']")
local argmatch = argmatch or {}
local argmatch = table_utils.shallowcopy(argmatch or {})
local tokens,args,opts = {},{},{}
-- Tokenize
for k,v in pairs(strings) do

View File

@ -305,6 +305,24 @@ local c_adminSpeak = command("adminSpeak", {
})
plugin:add_command(c_adminSpeak)
local c_adminSendToChannel = command("adminSendToChannel", {
category = "Utilities",
args = {
"textChannel",
"string"
},
exec = function(msg,args,opts)
local channel = args[1]
table.remove(args,1)
local text = table.concat(args," ")
channel:send(text)
end,
perms = {
"mentionEveryone"
}
})
plugin:add_command(c_adminSendToChannel)
local c_echo = command("echo",{
category = "Utilities",
args = {
@ -317,6 +335,21 @@ local c_echo = command("echo",{
})
plugin:add_command(c_echo)
local c_sendToChannel = command("sendToChannel",{
category = "Utilities",
args = {
"textChannel",
"string"
},
exec = function(msg,args,opts)
local channel = args[1]
table.remove(args,1)
local text = purify.purify_pings(msg, table.concat(args," "))
channel:send(text)
end,
})
plugin:add_command(c_sendToChannel)
local c_pingself = command("pingself",{
category = "Utilities",
args = {