33 lines
1.1 KiB
Lua
33 lines
1.1 KiB
Lua
|
|
-- "Напиши письмо имя_контакта" → 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("Открываю почтовый клиент.")
|