From 93f8a357a3b84b2a68bac965ee157e176b50b8bf Mon Sep 17 00:00:00 2001 From: Astoria Floyd Date: Fri, 6 Aug 2021 22:00:15 -0500 Subject: [PATCH] Added Echo --- .gitignore | 1 + basicCommands.lua | 10 ++++++++-- bot.lua | 20 ++++++++++++++++++++ gateway.json | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b100fa9..f1d27b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ discordia.log +gateway.json diff --git a/basicCommands.lua b/basicCommands.lua index 2692647..90d865d 100644 --- a/basicCommands.lua +++ b/basicCommands.lua @@ -11,8 +11,14 @@ function basicCommands.figlet(string) end function basicCommands.cowsay(string) - local figleted = io.popen("cowsay ".. string) - local result = figleted:read("*all") + local cowsaid = io.popen("cowsay ".. string) + local result = cowsaid:read("*all") + return result +end + +function basicCommands.echo(string) + local echoed = io.popen("echo ".. string) + local result = echoed:read("*all") return result end diff --git a/bot.lua b/bot.lua index 4fc8c8b..6c04052 100644 --- a/bot.lua +++ b/bot.lua @@ -12,6 +12,7 @@ end) client:on('messageCreate', function(message) if tools.messageDectection(message, "lenny") == true then message.channel:send("( ͡° ͜ʖ ͡°)") + message:delete() end end) @@ -34,6 +35,15 @@ client:on('messageCreate', function(message) end end) +client:on('userBan', function() + local banChannel, err = client:getChannel("872283716486066200") + if not banChannel then + p("Attempt to fetch the channel object: ", err) + return + end + banChannel:send("User was banned ( ͡° ͜ʖ ͡°)") +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') @@ -83,6 +93,16 @@ client:on('messageCreate', function(message) end end) +client:on('messageCreate', function(message) + if tools.messageDectection(message, "echo ") == true then + local echo = string.sub(message.content, 7) + local echoed = basicCommands.echo(echo) + local result = "```fix" .. "\n" .. echoed .. "```" + message.channel:send(result) + message:delete() + end +end) + client:on('messageCreate', function(message) if tools.messageDectection(message, "welsh") == true then image = "https://cdn.discordapp.com/attachments/748713417489252503/770289379586867231/image0.gif" diff --git a/gateway.json b/gateway.json index 0124440..e83e072 100644 --- a/gateway.json +++ b/gateway.json @@ -1 +1 @@ -{"873255296024322059":{"owner":{"id":"872299874857676820","discriminator":"0000","flags":1024,"username":"team872299874857676820","avatar":null,"public_flags":1024},"timestamp":1628296680,"shards":1},"url":"wss://gateway.discord.gg"} \ No newline at end of file +{"873255296024322059":{"owner":{"id":"872299874857676820","public_flags":1024,"username":"team872299874857676820","avatar":null,"flags":1024,"discriminator":"0000"},"shards":1,"timestamp":1628301547},"url":"wss://gateway.discord.gg"} \ No newline at end of file