28 lines
828 B
Lua
28 lines
828 B
Lua
|
|
-- "Повтори за мной привет всем"
|
|||
|
|
local phrase = (jarvis.context.phrase or "")
|
|||
|
|
local body = jarvis.text.strip_trigger(phrase:lower(), {
|
|||
|
|
"повтори за мной",
|
|||
|
|
"проверка эхо",
|
|||
|
|
"скажи как я",
|
|||
|
|
"эхо",
|
|||
|
|
"repeat after me",
|
|||
|
|
"echo",
|
|||
|
|
"повтори за мною",
|
|||
|
|
"ехо",
|
|||
|
|
})
|
|||
|
|
body = body:gsub("^[%s,:%.]+", ""):gsub("%s+$", "")
|
|||
|
|
|
|||
|
|
if body == "" then
|
|||
|
|
return jarvis.cmd.error("Что повторить?")
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
-- Preserve original casing — strip_trigger lowercased, but we can grab from the
|
|||
|
|
-- raw phrase by finding the lowercase prefix and skipping past it.
|
|||
|
|
local raw_lower = phrase:lower()
|
|||
|
|
local start_idx = raw_lower:find(body, 1, true)
|
|||
|
|
if start_idx then
|
|||
|
|
body = phrase:sub(start_idx, start_idx + #body - 1)
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
return jarvis.cmd.ok(body)
|