itte/examples/hachi/hachi.config.lua

37 lines
928 B
Lua

local irc = require("itte")
local folia = require("folia")
itte_config = {
debug = false,
messages = {
help = "Today's your lucky day, for I, hachi, also known to none as" ..
" the handsomer Hermes, shall bring you messages of ... well," ..
" wouldn't you like to know? For a bit of faux fortune-telling or" ..
" fickle forecasting, ask a question, then try: {{codes}}",
quit = "May fortune smile upon you all!",
reload = "Config reloaded.",
},
}
itte_handlers = {}
folia.foils_dir = "/home/mio/bin/itte/examples/hachi/foils"
local hachi = {}
-- Create handlers for each foil
function hachi.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
hachi.generate_handlers(itte_handlers, folia.foils_dir)