From 30115e0562ec045a0171dfdc9f66aa081e6032ea Mon Sep 17 00:00:00 2001 From: Astoria Floyd Date: Fri, 6 Aug 2021 19:32:38 -0500 Subject: [PATCH] cowsay added --- basicCommands.lua | 6 ++++++ bot.lua | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/basicCommands.lua b/basicCommands.lua index c3612ad..2692647 100644 --- a/basicCommands.lua +++ b/basicCommands.lua @@ -10,4 +10,10 @@ function basicCommands.figlet(string) return result end +function basicCommands.cowsay(string) + local figleted = io.popen("cowsay ".. string) + local result = figleted:read("*all") + return result +end + return basicCommands diff --git a/bot.lua b/bot.lua index 38b3a76..d3ac0de 100644 --- a/bot.lua +++ b/bot.lua @@ -67,4 +67,13 @@ client:on('messageCreate', function(message) end end) +client:on('messageCreate', function(message) + if tools.messageDectection(message, "cowsay ") == true then + local cowsay = string.sub(message.content, 9) + local cowsaid = basicCommands.cowsay(cowsay) + local result = "```fix" .. "\n" .. cowsaid .. "```" + message.channel:send(result) + end +end) + client:run('Bot ODczMjU1Mjk2MDI0MzIyMDU5.YQ1wXg.BbXq1fu-4nlG95EkLkHujVEObG4')