From 28cb7cf447b5e2705bba6d7e0d70392f6ed7e0c5 Mon Sep 17 00:00:00 2001 From: Astoria Floyd Date: Sat, 7 Aug 2021 14:10:28 -0500 Subject: [PATCH] Made commands case-insensitive, but maintained case in arguments and content. Removed test function --- bot.lua | 5 +++-- simpleCommands.lua | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bot.lua b/bot.lua index d2b2c50..3c59153 100644 --- a/bot.lua +++ b/bot.lua @@ -21,9 +21,10 @@ end) client:on('messageCreate', function(message) if message.author.bot then return end local args = message.content:split(" ") - local command = commands[args[1]] + local lowerArgs = args[1]:lower() + local command = commands[lowerArgs] if command then - command.exec(message) + command.exec(message, args) end end) diff --git a/simpleCommands.lua b/simpleCommands.lua index 3d47c0f..6c988a6 100644 --- a/simpleCommands.lua +++ b/simpleCommands.lua @@ -40,6 +40,11 @@ local commands = { -- Define commands its a table that will contain our commands message:delete() end }; +[prefix..'testArgs'] = { -- + exec = function (message, args) + message.channel:send(args[2]) + end + }; }