From 37d1167ae402d2f8ec13baee8a006f7ed8f78ee8 Mon Sep 17 00:00:00 2001 From: astoria Date: Fri, 13 Aug 2021 04:25:17 +0000 Subject: [PATCH] Fumo Mode Working. Relies on a overly specific server setup, fix later. --- API/tools.lua | 5 ++++- commands/complexCommands.lua | 12 ++++++++++++ commands/experimentalCommands.lua | 7 ------- fumoCopy.sh | 3 ++- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/API/tools.lua b/API/tools.lua index 4b68a14..0472563 100644 --- a/API/tools.lua +++ b/API/tools.lua @@ -133,6 +133,10 @@ function tools.fumoLines() return(fumoFile) end +function tools.fumoClone() + os.execute("/bin/bash fumoCopy.sh") +end + function tools.fumoList() local lineList = tools.fumoLines() local fumoList = {} @@ -144,7 +148,6 @@ function tools.fumoList() fumoList[number]=file:read() end file:close() - print(fumoList[1]) return(fumoList) end diff --git a/commands/complexCommands.lua b/commands/complexCommands.lua index 555f608..bd85d30 100644 --- a/commands/complexCommands.lua +++ b/commands/complexCommands.lua @@ -25,6 +25,18 @@ local commands = { -- Define commands its a table that will contain our commands end }; +[prefix..'fumo'] = { -- To be implemented later.. +exec = function (message) + local fumoLines = tools.fumoLines() + local fumoList = tools.fumoList() + tools.fumoClone() + tools.seed() + local fumo = fumoList[math.random(fumoLines)] + local msg = "https://broken-moon.net/"..fumo + message.channel:send(msg) +end +}; + --[[ [prefix..'figlet'] = { -- Parrots input to figlet, then echos it to the same channel you are in. exec = function (message) diff --git a/commands/experimentalCommands.lua b/commands/experimentalCommands.lua index 405be3e..2265cf9 100644 --- a/commands/experimentalCommands.lua +++ b/commands/experimentalCommands.lua @@ -10,13 +10,6 @@ local commands = { -- Define commands its a table that will contain our commands end }; -[prefix..'fumo'] = { -- To be implemented later.. -exec = function (message) - local fumoLines = tools.fumoLines() - local fumoList = tools.fumoList() -end -}; - } function experimentalCommands.initialize() diff --git a/fumoCopy.sh b/fumoCopy.sh index fb49349..dd8da49 100755 --- a/fumoCopy.sh +++ b/fumoCopy.sh @@ -1 +1,2 @@ -echo "$(cp fumo/* /var/www/html/fumo)" \ No newline at end of file +echo "$(rm /var/www/html/fumo/*)" +echo "$(cp fumo/*.gif /var/www/html/fumo)" \ No newline at end of file