mirror of
https://github.com/Priler/jarvis.git
synced 2026-06-09 05:44:42 +00:00
basic Lua 5.4 implementation with few example commands
This commit is contained in:
21
resources/commands/hello/script.lua
Normal file
21
resources/commands/hello/script.lua
Normal 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 }
|
||||
Reference in New Issue
Block a user