From 63f32dccc7edf91965aa7129f0c9d20358578d19 Mon Sep 17 00:00:00 2001 From: Astoria Floyd Date: Fri, 6 Aug 2021 19:27:15 -0500 Subject: [PATCH] added in figlet functionality --- .vscode/launch.json | 14 ++++++++++++++ basicCommands.lua | 6 ++++++ bot.lua | 7 +++++-- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..846864b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lua", + "request": "launch", + "name": "Debug", + "program": "${file}" + } + ] +} \ No newline at end of file diff --git a/basicCommands.lua b/basicCommands.lua index e0d6a6a..c3612ad 100644 --- a/basicCommands.lua +++ b/basicCommands.lua @@ -4,4 +4,10 @@ function basicCommands.helloWorld() return("Hello world!") end +function basicCommands.figlet(string) + local figleted = io.popen("figlet ".. string) + local result = figleted:read("*all") + return result +end + return basicCommands diff --git a/bot.lua b/bot.lua index e30f3fe..38b3a76 100644 --- a/bot.lua +++ b/bot.lua @@ -59,8 +59,11 @@ client:on('messageCreate', function(message) end) client:on('messageCreate', function(message) - if tools.messageDectection(message, "moduleTest") == true then - message.channel:send(basicCommands.helloWorld()) + if tools.messageDectection(message, "figlet ") == true then + local figletthis = string.sub(message.content, 9) + local figlet = basicCommands.figlet(figletthis) + local result = "```fix" .. "\n" .. figlet .. "```" + message.channel:send(result) end end)