basic Lua 5.4 implementation with few example commands

This commit is contained in:
Priler 2026-01-17 05:46:38 +05:00
parent c9b9482cc8
commit c4a774b5cf
35 changed files with 2554 additions and 460 deletions

View file

@ -0,0 +1,14 @@
[[commands]]
id = "hello"
type = "lua"
script = "script.lua"
sandbox = "minimal"
timeout = 5000
phrases.ru = [
"привет",
"здравствуй",
]
phrases.en = [
"hello",
"hi",
]

View file

@ -0,0 +1,21 @@
-- simple test hello command
local lang = jarvis.context.language
local hour = tonumber(jarvis.context.time.hour)
-- determine greeting based on time
local greeting
if hour >= 5 and hour < 12 then
greeting = lang == "ru" and "Доброе утро" or "Good morning"
elseif hour >= 12 and hour < 17 then
greeting = lang == "ru" and "Добрый день" or "Good afternoon"
elseif hour >= 17 and hour < 22 then
greeting = lang == "ru" and "Добрый вечер" or "Good evening"
else
greeting = lang == "ru" and "Доброй ночи" or "Good night"
end
jarvis.log("info", "Greeting user: " .. greeting)
jarvis.audio.play_reply()
return { chain = true }