From a37d085ab76eb37014b8bc7742042fdd5b232bcd Mon Sep 17 00:00:00 2001 From: Astoria Floyd Date: Fri, 6 Aug 2021 18:59:22 -0500 Subject: [PATCH] forced lowercase when checking for shit --- bot.lua | 27 +++++++++++++++++++-------- tools.lua | 11 ++++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/bot.lua b/bot.lua index 47ea10a..e30f3fe 100644 --- a/bot.lua +++ b/bot.lua @@ -15,12 +15,31 @@ client:on('messageCreate', function(message) end end) +client:on('messageCreate', function(message) + if tools.messageDectection(message, "glomp") == true then + message.channel:send("https://tenor.com/view/tv-shows-television-tackle-hug-hug-glomping-gif-14859564") + end +end) + +client:on('messageCreate', function(message) + if message.author.bot then return end + if tools.messageDectectionAnywhere(message, "gif") == true then + message.channel:send("GIF IS PRONOUNCED WITH A HARD G, ITS NOT JIF OR YIFF") + end +end) + client:on('messageCreate', function(message) if tools.messageDectection(message, "ping") == true then message.channel:send('Pong!') end end) +client:on('messageCreate', function(message) + if tools.messageDectection(message, "fire") == true then + message.channel:send('https://tenor.com/view/elmo-fire-burn-flame-gif-5042503') + end +end) + client:on('messageCreate', function(message) if tools.messageDectection(message, "helpme") == true then message.channel:send(tools.printFile("docs/help")) @@ -32,15 +51,7 @@ client:on('messageCreate', function(message) message.channel:send(rng.d20()) end end) ---[[ -client:on('messageCreate', function(message) - if message.content == '!time' then - message.channel:send('The current time in military time is ' .. os.date() .. ', atleast in Chicago!') - end -end) -]] ---Replacing the above with a more tolerant version client:on('messageCreate', function(message) if tools.messageDectection(message, "time") == true then message.channel:send('The current time in military time is ' .. os.date() .. ' atleast in Chicago!') diff --git a/tools.lua b/tools.lua index a218352..b8034af 100644 --- a/tools.lua +++ b/tools.lua @@ -14,7 +14,7 @@ function tools.printFile(file) end function tools.messageDectection(message, search) - local distinctMessage = message.content + local distinctMessage = string.lower(message.content) local key = "!" local keyedSearch = key .. search if string.find(distinctMessage, keyedSearch) == 1 then @@ -24,4 +24,13 @@ function tools.messageDectection(message, search) end end +function tools.messageDectectionAnywhere(message, search) + local distinctMessage = string.lower(message.content) + if string.find(distinctMessage, search) ~= nil then + return true + else + return false + end +end + return tools \ No newline at end of file