J.A.R.V.I.S-rust/resources/commands/routines/good_morning.lua

46 lines
1.6 KiB
Lua
Raw Normal View History

-- "Good morning" routine:
-- 1. switch active profile back to "default"
-- 2. count today's scheduled tasks
-- 3. reply with a varied morning greeting + agenda hint
local lang = jarvis.context.language
pcall(function() jarvis.profile.set("default") end)
local tasks_today = jarvis.scheduler.list() or {}
local n_tasks = #tasks_today
local lines_ru = {
"Доброе утро, сэр. Системы в порядке.",
"Доброе утро. Готов к новому дню.",
"С пробуждением, сэр. День в норме.",
"Доброе утро, сэр. Кофе сам себя не сварит.",
"Доброе утро. Все онлайн, рапорт по запросу.",
}
local lines_en = {
"Good morning, sir. All systems nominal.",
"Good morning. Ready for the day.",
"Welcome back, sir. The day looks normal.",
"Good morning, sir. The coffee won't brew itself.",
"Good morning. Everything online, ready when you are.",
}
local pool = (lang == "ru") and lines_ru or lines_en
local greeting = pool[math.random(#pool)]
local agenda
if n_tasks > 0 then
if lang == "ru" then
agenda = " В расписании " .. tostring(n_tasks) .. ", скажите 'покажи расписание', чтобы услышать."
else
agenda = " " .. tostring(n_tasks) .. " scheduled — say 'show schedule' for details."
end
else
if lang == "ru" then
agenda = " Расписание чистое."
else
agenda = " Schedule is clear."
end
end
return jarvis.cmd.ok(greeting .. agenda)