Compare commits

..

1 Commits

Author SHA1 Message Date
mio 20fd463f5b Add scheduled tasks 2022-04-01 03:56:44 -04:00
1 changed files with 11 additions and 16 deletions

View File

@ -423,22 +423,14 @@ local h = {}
-- Serve ramen. -- Serve ramen.
function h.ramen(cxt, msg) function h.ramen(cxt, msg)
local recipients = { msg.reply_to }
local intro = ""
-- Scheduled task recipients
if msg.recipients ~= nil then
recipients = msg.recipients
intro = "Now serving! "
end
-- 1% chance of special set -- 1% chance of special set
local roll = math.random(1, 100) local roll = math.random(1, 100)
if roll == 77 then if roll == 77 then
irc.message(cxt, recipients, intro .. irc.message(cxt, { msg.reply_to },
string.gsub(itte_config.messages.special, "{{ramen}}", string.gsub(itte_config.messages.special, "{{ramen}}",
ramen.make_ramen("veg_special"))) ramen.make_ramen("veg_special")))
else else
irc.message(cxt, recipients, intro .. irc.message(cxt, { msg.reply_to },
string.gsub(itte_config.messages.serve, "{{ramen}}", string.gsub(itte_config.messages.serve, "{{ramen}}",
ramen.make_ramen("veg"))) ramen.make_ramen("veg")))
end end
@ -447,16 +439,19 @@ end
-- Serve meat-based ramen. -- Serve meat-based ramen.
function h.mramen(cxt, msg) function h.mramen(cxt, msg)
local recipients = { msg.reply_to }
-- Scheduled task recipients
if msg.recipients ~= nil then
recipients = msg.recipients
end
-- 1% chance of special set -- 1% chance of special set
local roll = math.random(1, 100) local roll = math.random(1, 100)
if roll == 77 then if roll == 77 then
irc.message(cxt, { msg.reply_to }, irc.message(cxt, recipients, string.gsub(itte_config.messages.special,
string.gsub(itte_config.messages.special, "{{ramen}}", "{{ramen}}", ramen.make_ramen("meat_special")))
ramen.make_ramen("meat_special")))
else else
irc.message(cxt, { msg.reply_to }, irc.message(cxt, recipients, string.gsub(itte_config.messages.serve,
string.gsub(itte_config.messages.serve, "{{ramen}}", "{{ramen}}", ramen.make_ramen("meat")))
ramen.make_ramen("meat")))
end end
end end