itte/examples/gordon/gordon.config.lua

39 lines
755 B
Lua
Raw Normal View History

2022-08-29 23:13:52 +00:00
local irc = require("itte")
local folia = require("folia")
itte_config = {
debug = false,
messages = {
help = "Casa's Kitchen commands: {{codes}}",
quit = "Machef under maintenance.",
reload = "Config reloaded.",
},
}
itte_handlers = {}
folia.foils_dir = arg[0] .. "/commands"
local gordon = {}
-- Show help message
function itte_handlers.botland(cxt, msg)
irc._h.help(cxt, msg)
end
-- 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
end
gordon.generate_handlers(itte_handlers, folia.foils_dir)