Merge pull request 'Add fumo command, along with required API and gifs.' (#6) from fumo into main

Reviewed-on: #6
pull/7/head
astoriaFloyd 3 years ago
commit 659481b5b1

@ -0,0 +1,3 @@
fumoFileText=$(find fumoGif/* | grep -i .gif)
fumoFileNumbers=$(wc -l <<< "$fumoFileText")
echo "$fumoFileNumbers" > "docs/fumoFile"

@ -0,0 +1,2 @@
fumoFileText=$(find fumoGif/* | grep -i .gif)
echo "$fumoFileText" > "docs/fumoFile"

@ -118,6 +118,38 @@ function tools.tableMerge(t1, t2)
return t1
end
--Work on this later, simplify fumo command, less hardcoding, please.
function tools.massDetection(folder, filetype)
local command = "find "..folder.." | grep -i "..filetype.." | grep -n "..filetype
local result = io.popen(command)
return(result)
end
-- Checks fumoFile after running the fumoLine numbering script, to get the number of .gif files there are.
function tools.fumoLines()
os.execute("/bin/bash API/fumoLines.sh")
local file = io.open("./docs/fumoFile", "r")
local fumoFile = file:read()
file:close()
return(fumoFile)
end
-- Creates a table of every gif in the /fumoGif folder. Uses the fumoList script to get their location, and the fumoLine script to get what line number they are, which is their key
function tools.fumoList()
local lineList = tools.fumoLines()
local fumoList = {}
os.execute("/bin/bash API/fumoList.sh")
local file = io.open("./docs/fumoFile", "r")
for i = lineList,1,-1
do
local number = i
fumoList[number]=file:read()
end
file:close()
return(fumoList)
end
--Message detection logic. If string.find detects both the desired string, and the key, starting at position 1, do the thing.
--Now deprecated
function tools.messageDectection(message, search)

@ -25,6 +25,17 @@ local commands = { -- Define commands its a table that will contain our commands
end
};
[prefix..'fumo'] = { -- Posts a random fumo gif from /fumoGif, fully reloads the list of gifs each run
exec = function (message)
local fumoLines = tools.fumoLines()
local fumoList = tools.fumoList()
tools.seed()
local fumo = fumoList[math.random(fumoLines)]
local msg = fumo
message.channel:send{file = msg}
end
};
--[[
[prefix..'figlet'] = { -- Parrots input to figlet, then echos it to the same channel you are in.
exec = function (message)

@ -9,12 +9,7 @@ local commands = { -- Define commands its a table that will contain our commands
message.channel:send("Experimental mode works!")
end
};
--[[
[prefix..'fumo'] = { -- To be implemented later..
exec = function (message)
end
};
]]
}
function experimentalCommands.initialize()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Loading…
Cancel
Save