(gordon) Fix parsing

mio 2022-08-30 03:08:54 +00:00
parent cdf8bcade0
commit 17fb088c0f
5 changed files with 27 additions and 20 deletions

View File

@ -1,5 +1,5 @@
grammar = {
meatset = {
meat_set = {
"360 Burger with a large patty, tomatos, cheddar and onions in a Dijon mustard sauce",
"Bada Boom cheeseburger with a juicy steak, cheddar, onions and tomatos",
"Bag Baguette featuring two patties and Emmental cheese in a long crusty baguette",
@ -23,14 +23,14 @@ grammar = {
"Super Bacon burger",
"Vast Veggie burger with a veggie patty and Emmental cheese",
},
veggieset = {
veggie_set = {
"Veggie Thing overflowing with a spicy sauce",
},
meatside = {
meat_side = {
"chicken fries",
"house fries with a mayonnaise dip",
},
veggieside = {
veggie_side = {
"chips deluged with potato sauce",
"onion rings",
},
@ -40,11 +40,11 @@ grammar = {
"set of 3 petit pancakes topped with hazelnut cocoa or strawberry cream",
},
origin = {
"Here, have a #meatset# !",
"Here, have a #veggieset# !",
"Here, have a #meatset# served with a side of #meatside# !",
"Here, have a #meatset# served with a side of #veggieside# !",
"Here, have a #veggieset# served with a side of #veggieside# !",
"Here, have a #meatset# served with a #dessert# !",
"Here, have a #meat_set#!",
"Here, have a #veggie_set#!",
"Here, have a #meat_set# served with a side of #meat_side#!",
"Here, have a #meat_set# served with a side of #veggie_side#!",
"Here, have a #veggie_set# served with a side of #veggie_side#!",
"Here, have a #meat_set# served with a #dessert#!",
}
}

View File

@ -54,7 +54,7 @@ function folia.output(key)
end
local output_str = util.pick(foils[key]["origin"])[1]
local pattern = "#(%w+)#"
local pattern = "#(%w+_*%-*%w+)#"
util.debug("output", "level 1: " .. output_str, folia.debug)
-- Check for expansion objects and replace them until none are found
while string.find(output_str, pattern) ~= nil do

View File

@ -4,8 +4,9 @@ local folia = require("folia")
itte_config = {
debug = false,
messages = {
help = "Casa's Kitchen commands: {{codes}}",
quit = "Machef under maintenance.",
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.",
},
}
@ -18,12 +19,6 @@ folia.foils_dir = "/home/mio/bin/itte/examples/gordon/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)
@ -32,6 +27,18 @@ function gordon.generate_handlers(handlers, foils_dir)
irc.message(cxt, { msg.reply_to }, folia.output(key))
end
end
-- Add aliases
if folia.output("burger") ~= nil then
itte_handlers.borgar = function (cxt, msg)
irc.message(cxt, { msg.reply_to }, folia.output("burger"))
end
end
if folia.output("coffee") ~= nil then
itte_handlers.cofe = function (cxt, msg)
irc.message(cxt, { msg.reply_to }, folia.output("coffee"))
end
end
end

View File

@ -54,7 +54,7 @@ function folia.output(key)
end
local output_str = util.pick(foils[key]["origin"])[1]
local pattern = "#(%w+)#"
local pattern = "#(%w+_*%-*%w+)#"
util.debug("output", "level 1: " .. output_str, folia.debug)
-- Check for expansion objects and replace them until none are found
while string.find(output_str, pattern) ~= nil do