Implement commander only mode for commands

This commit is contained in:
2025-01-05 23:26:28 +01:00
parent 2e805abef7
commit 6059c16a6e
3 changed files with 17 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
## Interface: 70300
## Title: Heimdall
## Version: 2.11.0
## Notes: Watches over areas and alerts when hostiles spotted
## Author: Cyka
## SavedVariables: Heimdall_Data

BIN
Heimdall.zip LFS

Binary file not shown.

View File

@@ -167,8 +167,11 @@ function shared.Commander.Init()
local channelId = select(6, ...)
local _, channelname = GetChannelName(channelId)
if channelname ~= Heimdall_Data.config.commander.masterChannel then return end
sender = string.match(sender, "^[^-]+")
for _, command in ipairs(commands) do
if not command.commanderOnly or
(command.commanderOnly and sender == Heimdall_Data.config.commander.commander) then
if msg:match(command.keywordRe) then
local messages = command.callback({ strsplit(" ", msg) })
for _, message in ipairs(messages) do
@@ -182,6 +185,7 @@ function shared.Commander.Init()
end
end
end
end
end)
print("Heimdall - Commander loaded")