Compare commits

..

No commits in common. "f4b84df7a32e8a88b709c18a124f0ed8dc7dd2e6" and "2db65f578859cdb3000dc06da16c88f9bab69772" have entirely different histories.

2 changed files with 7 additions and 11 deletions

View File

@ -123,7 +123,7 @@ air.parse = function(string,argmatch,client,guild_id)
for k,v in pairs(tokens) do for k,v in pairs(tokens) do
if v:match("^%-%-%w+=$") then if v:match("^%-%-%w+=$") then
local optname = table.remove(tokens,k):match("^%-%-(%w+)=$") local optname = table.remove(tokens,k):match("^%-%-(%w+)=$")
local value = tokens[k]:match("^[\"']?(.-)[\"']?$") local value = tokens[k]
opts[optname] = value opts[optname] = value
elseif v:match("^%-%-%w+$") then elseif v:match("^%-%-%w+$") then
local optname = v:match("^%-%-(%w+)$") local optname = v:match("^%-%-(%w+)$")

View File

@ -22,16 +22,12 @@ for k,v in pairs(command_handler:get_prefixes()) do
end end
local function add_alias(name,comm,prefix,description) local function add_alias(name,comm,prefix,description)
local helpmsg = "Alias for ``"..comm.."``"
if description then
helpmsg = helpmsg.."\n"..description
end
if (not aliases[name]) then if (not aliases[name]) then
log("ALIAS","Adding alias \""..name.."\" for \""..comm.."\"") log("ALIAS","Adding alias \""..name.."\" for \""..comm.."\"")
config.aliases[name] = {comm = comm,prefix = prefix,description = description} config.aliases[name] = {comm = comm,prefix = (prefix == nil)}
aliases[name] = command(name,{ aliases[name] = command(name,{
help = helpmsg, help = "Alias for ``"..comm.."``",
usage = name, usage = ((prefix and globals.prefix) or "")..name,
category = "Aliases", category = "Aliases",
exec = function(msg,args2,opts) exec = function(msg,args2,opts)
local str = msg.content:gsub("^%S+ ?","") local str = msg.content:gsub("^%S+ ?","")
@ -46,7 +42,7 @@ local function add_alias(name,comm,prefix,description)
})) }))
end, end,
options = { options = {
prefix = config.aliases[name].prefix, prefix = (prefix == nil),
custom = true custom = true
} }
}) })
@ -73,7 +69,7 @@ for k,v in pairs(config.aliases) do
if type(v) == "string" then --legacy format conversion if type(v) == "string" then --legacy format conversion
commdata = {comm = v, prefix = false} commdata = {comm = v, prefix = false}
end end
add_alias(k,commdata.comm,commdata.prefix,commdata.description) add_alias(k,commdata.comm,commdata.prefix)
end end
local prefix = command("prefix",{ local prefix = command("prefix",{
@ -124,7 +120,7 @@ local c_alias = command("alias", {
}, },
category = "Automation", category = "Automation",
exec = function(msg,args,opts) exec = function(msg,args,opts)
if add_alias(args[1],args[2],not (opts["prefix"] or opts["p"]),opts["description"]) then if add_alias(args[1],args[2],(opts["prefix"] or opts["p"]),opts["description"]) then
msg:reply("Bound ``"..args[1].."`` as an alias to ``"..args[2].."``") msg:reply("Bound ``"..args[1].."`` as an alias to ``"..args[2].."``")
else else
msg:reply("``"..args[1].."`` is already bound") msg:reply("``"..args[1].."`` is already bound")