J.A.R.V.I.S-rust/resources/commands/mailto/compose.lua

33 lines
1.1 KiB
Lua
Raw Permalink Normal View History

docs+feat: USAGE.md + interesting_fact + mailto packs USAGE.md (new, ~250 lines) - Complete voice command reference organised by 13 categories - Table-formatted for fast skim ("Команда → Что делает") - Sections: Управление ассистентом / LLM / Память+профили+macros / Расписание / Окна+апп / Аудио+медиа / Система / Файлы+буфер / Информация из интернета / Утилиты-калькуляторы / Разработка / Развлечения / Скриншоты - Bottom: "Как добавить свою команду" with Lua snippet template, "Голосовое vs GUI" mapping, troubleshooting checklist (mic / TTS / LLM / command-not-found / logs). - Covers all 67 packs visible in resources/commands/. interesting_fact pack (resources/commands/interesting_fact/, 2 cmds) - fact.about "удиви меня" / "интересный факт про космос" → LLM with "curious conversationalist" prompt, generic or topic-targeted (1-2 sentences, no fluff). - fact.history_today "что было в этот день" / "этот день в истории" → Wikipedia "On this day" API (RU first, EN fallback) → LLM picks top 2-3 events, narrates concisely. mailto pack (resources/commands/mailto/, 1 cmd) - mailto.compose "напиши письмо" / "напиши письмо маме" → opens default mail client via mailto: URI. Looks up recipient via jarvis.memory ("email_маме") if a name is given. - Pairs well with: jarvis.memory.remember("email_маме", "mom@example.com") Pack count: 67 → 70. Tests: 112/112.
2026-05-15 23:38:03 +03:00
-- "Напиши письмо имя_контакта" → opens mailto: URI in default handler.
-- For now just opens a blank compose; could be extended to pull recipient
-- from memory ("маме", "коллеге") via lookups.
local phrase = (jarvis.context.phrase or ""):lower()
local target = jarvis.text.strip_trigger(phrase, {
"напиши письмо",
"новое письмо",
"открой почту",
"составить письмо",
"compose email",
"new email",
"open mail",
})
target = target:gsub("^[%s,:%.]+", ""):gsub("%s+$", "")
local recipient = ""
if target ~= "" then
-- Try memory lookup — "напиши письмо маме" → memory.recall("email_маме")
local key = "email_" .. target
local addr = jarvis.memory.recall(key)
if addr and addr ~= "" then
recipient = addr
end
end
local uri = recipient ~= "" and ("mailto:" .. recipient) or "mailto:"
jarvis.system.open(uri)
if recipient ~= "" then
return jarvis.cmd.ok("Открываю письмо для " .. target .. ".")
end
return jarvis.cmd.ok("Открываю почтовый клиент.")