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!