41 lines
962 B
Lua
41 lines
962 B
Lua
local irc = require("itte")
|
|
local folia = require("folia")
|
|
|
|
itte_config = {
|
|
debug = false,
|
|
messages = {
|
|
help = "Don't just stand there like a big f—ing muffin! " ..
|
|
"Order something! Your Casa's Kitchen commands are: {{codes}}",
|
|
quit = "Master Chef under maintenance.",
|
|
reload = "Config reloaded.",
|
|
},
|
|
}
|
|
|
|
itte_handlers = {}
|
|
|
|
folia.foils_dir = "/home/mio/bin/itte/examples/gordon/commands"
|
|
|
|
|
|
local gordon = {}
|
|
|
|
|
|
-- Create handlers for each foil
|
|
function gordon.generate_handlers(handlers, foils_dir)
|
|
local foils = folia.get_foils(foils_dir)
|
|
for key, foil in pairs(foils) do
|
|
handlers[key] = function (cxt, msg)
|
|
irc.message(cxt, { msg.reply_to }, folia.output(key))
|
|
end
|
|
end
|
|
|
|
-- Add aliases
|
|
if folia.output("coffee") ~= nil then
|
|
itte_handlers.cofe = function (cxt, msg)
|
|
irc.message(cxt, { msg.reply_to }, folia.output("coffee"))
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
gordon.generate_handlers(itte_handlers, folia.foils_dir)
|