Compare commits

..

1 Commits

Author SHA1 Message Date
mio e9927fb1d7 Add scheduled tasks 2022-04-01 04:14:15 -04:00
1 changed files with 16 additions and 11 deletions

View File

@ -423,14 +423,22 @@ local h = {}
-- Serve ramen.
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
local roll = math.random(1, 100)
if roll == 77 then
irc.message(cxt, { msg.reply_to },
irc.message(cxt, recipients, intro ..
string.gsub(itte_config.messages.special, "{{ramen}}",
ramen.make_ramen("veg_special")))
else
irc.message(cxt, { msg.reply_to },
irc.message(cxt, recipients, intro ..
string.gsub(itte_config.messages.serve, "{{ramen}}",
ramen.make_ramen("veg")))
end
@ -439,19 +447,16 @@ end
-- Serve meat-based ramen.
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
local roll = math.random(1, 100)
if roll == 77 then
irc.message(cxt, recipients, string.gsub(itte_config.messages.special,
"{{ramen}}", ramen.make_ramen("meat_special")))
irc.message(cxt, { msg.reply_to },
string.gsub(itte_config.messages.special, "{{ramen}}",
ramen.make_ramen("meat_special")))
else
irc.message(cxt, recipients, string.gsub(itte_config.messages.serve,
"{{ramen}}", ramen.make_ramen("meat")))
irc.message(cxt, { msg.reply_to },
string.gsub(itte_config.messages.serve, "{{ramen}}",
ramen.make_ramen("meat")))
end
end