-- "напомни в 18:00 забрать ребёнка" local phrase = (jarvis.context.phrase or ""):lower() local body = jarvis.text.strip_trigger(phrase, { "напомни сегодня в", "напомни в", "разбуди в", "поставь напоминалку на", "remind me at", "wake me at", "нагадай о", "розбуди о", }) body = body:gsub("^[%s,:%.]+", ""):gsub("%s+$", "") -- Parse "HH:MM " or "HH MM " local h, m, rest = body:match("^(%d%d?)%s*[:%-%s]%s*(%d%d?)%s*(.*)$") if not h then h, rest = body:match("^(%d%d?)%s*(.*)$") if not h then jarvis.speak("Не понял время.") jarvis.audio.play_error() return { chain = false } end m = "00" end m = m or "00" local hn = tonumber(h) local mn = tonumber(m) if hn < 0 or hn > 23 or mn < 0 or mn > 59 then jarvis.speak("Время вне диапазона.") jarvis.audio.play_error() return { chain = false } end local schedule = string.format("at %02d:%02d", hn, mn) local text_body = (rest or ""):gsub("^[%s,:%.]+", ""):gsub("%s+$", "") if text_body == "" then text_body = "Напоминание." end local ok, err = pcall(function() jarvis.scheduler.add({ name = "Reminder", schedule = schedule, action = { type = "speak", text = text_body } }) end) if not ok then jarvis.log("warn", "scheduler.add: " .. tostring(err)) jarvis.speak("Не получилось.") jarvis.audio.play_error() return { chain = false } end jarvis.speak(string.format("Напомню в %02d:%02d.", hn, mn)) jarvis.audio.play_ok() return { chain = false }