2022-03-22 05:44:25 +00:00
|
|
|
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" ..
|
2022-03-23 16:27:08 +00:00
|
|
|
" fickle forecasting, ask a question, and try: {{codes}}",
|
2022-03-22 05:44:25 +00:00
|
|
|
quit = "May fortune smile upon you all!",
|
|
|
|
reload = "Config reloaded.",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
itte_handlers = {}
|
|
|
|
|
|
|
|
folia.foils_dir = "/home/mio/bin/itte/examples/hachi/foils"
|
|
|
|
|
|
|
|
|
|
|
|
local hachi = {}
|
|
|
|
|
|
|
|
|
2022-03-23 16:27:08 +00:00
|
|
|
-- Show help message
|
|
|
|
function itte_handlers.botland(cxt, msg)
|
|
|
|
irc._h.help(cxt, msg)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2022-03-22 05:44:25 +00:00
|
|
|
-- 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)
|