Implement commander only mode for commands
This commit is contained in:
@@ -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
BIN
Heimdall.zip
LFS
Binary file not shown.
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user