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,18 +167,22 @@ 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 msg:match(command.keywordRe) then
|
||||
local messages = command.callback({ strsplit(" ", msg) })
|
||||
for _, message in ipairs(messages) do
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "CHANNEL",
|
||||
data = channelname,
|
||||
message = message
|
||||
}
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
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
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "CHANNEL",
|
||||
data = channelname,
|
||||
message = message
|
||||
}
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user