From f4b84df7a32e8a88b709c18a124f0ed8dc7dd2e6 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Tue, 12 Jul 2022 15:26:32 +0400 Subject: [PATCH] Fixed alias description system --- libraries/air.lua | 2 +- plugins/meta/init.lua | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libraries/air.lua b/libraries/air.lua index 8b7c49a..38a60b2 100644 --- a/libraries/air.lua +++ b/libraries/air.lua @@ -123,7 +123,7 @@ air.parse = function(string,argmatch,client,guild_id) for k,v in pairs(tokens) do if v:match("^%-%-%w+=$") then local optname = table.remove(tokens,k):match("^%-%-(%w+)=$") - local value = tokens[k] + local value = tokens[k]:match("^[\"']?(.-)[\"']?$") opts[optname] = value elseif v:match("^%-%-%w+$") then local optname = v:match("^%-%-(%w+)$") diff --git a/plugins/meta/init.lua b/plugins/meta/init.lua index 688632f..7e3aa59 100644 --- a/plugins/meta/init.lua +++ b/plugins/meta/init.lua @@ -22,11 +22,15 @@ for k,v in pairs(command_handler:get_prefixes()) do end 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 log("ALIAS","Adding alias \""..name.."\" for \""..comm.."\"") - config.aliases[name] = {comm = comm,prefix = prefix} + config.aliases[name] = {comm = comm,prefix = prefix,description = description} aliases[name] = command(name,{ - help = "Alias for ``"..comm.."``", + help = helpmsg, usage = name, category = "Aliases", exec = function(msg,args2,opts) @@ -69,7 +73,7 @@ for k,v in pairs(config.aliases) do if type(v) == "string" then --legacy format conversion commdata = {comm = v, prefix = false} end - add_alias(k,commdata.comm,commdata.prefix) + add_alias(k,commdata.comm,commdata.prefix,commdata.description) end local prefix = command("prefix",{