From 22581c242bfcbe6cae940a65267794af5c742ae5 Mon Sep 17 00:00:00 2001 From: Astoria Floyd Date: Fri, 6 Aug 2021 16:07:29 -0500 Subject: [PATCH] Basic IO, help unfinished --- bot.lua | 18 ++++++++++++++++-- docs/help | 3 +++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 docs/help diff --git a/bot.lua b/bot.lua index 994307c..3cb9ad3 100644 --- a/bot.lua +++ b/bot.lua @@ -2,8 +2,9 @@ local discordia = require('discordia') local client = discordia.Client() seed = os.time() math.randomseed(seed) +tabletest = {Hello, Hi, Lol} -function messageDectection (message, search) +function messageDectection(message, search) distinctMessage = message.content key = "!" keyedSearch = key .. search @@ -11,10 +12,17 @@ function messageDectection (message, search) return true else return false -end + end end +function printFile(file) + rawFile = io.open(file, r) + message = rawFile:read("*all") + rawFile:close() + return message +end + client:on('ready', function() print('Logged in as '.. client.user.username) end) @@ -25,6 +33,12 @@ client:on('messageCreate', function(message) end end) +client:on('messageCreate', function(message) + if messageDectection(message, "ThemHelp") == true then + message.channel:send(printFile("docs/help")) + end +end) + client:on('messageCreate', function(message) if messageDectection(message, "roll") == true then dice = math.random(20) diff --git a/docs/help b/docs/help new file mode 100644 index 0000000..ee77fa4 --- /dev/null +++ b/docs/help @@ -0,0 +1,3 @@ +Hello! +Line 2 +Line 3!