local irc = require("itte") local folia = require("folia") local soupe = require("soupe") 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.", }, foils_dir = "/home/mio/bin/itte/examples/gordon/commands", nouns_file = "/home/mio/bin/itte/examples/gordon/words/nouns.txt", } itte_handlers = {} folia.foils_dir = itte_config.foils_dir soupe.nouns_file = itte_config.nouns_file 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 -- Add separate handler function itte_handlers.soupe(cxt, msg) local resp = "Here! A " .. soupe.make_soup() .. "!" irc.message(cxt, { msg.reply_to }, resp) end gordon.generate_handlers(itte_handlers, folia.foils_dir)