Implement commander only mode for commands
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
## Interface: 70300
|
## Interface: 70300
|
||||||
## Title: Heimdall
|
## Title: Heimdall
|
||||||
|
## Version: 2.11.0
|
||||||
## Notes: Watches over areas and alerts when hostiles spotted
|
## Notes: Watches over areas and alerts when hostiles spotted
|
||||||
## Author: Cyka
|
## Author: Cyka
|
||||||
## SavedVariables: Heimdall_Data
|
## 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 channelId = select(6, ...)
|
||||||
local _, channelname = GetChannelName(channelId)
|
local _, channelname = GetChannelName(channelId)
|
||||||
if channelname ~= Heimdall_Data.config.commander.masterChannel then return end
|
if channelname ~= Heimdall_Data.config.commander.masterChannel then return end
|
||||||
|
sender = string.match(sender, "^[^-]+")
|
||||||
|
|
||||||
for _, command in ipairs(commands) do
|
for _, command in ipairs(commands) do
|
||||||
if msg:match(command.keywordRe) then
|
if not command.commanderOnly or
|
||||||
local messages = command.callback({ strsplit(" ", msg) })
|
(command.commanderOnly and sender == Heimdall_Data.config.commander.commander) then
|
||||||
for _, message in ipairs(messages) do
|
if msg:match(command.keywordRe) then
|
||||||
---@type Message
|
local messages = command.callback({ strsplit(" ", msg) })
|
||||||
local msg = {
|
for _, message in ipairs(messages) do
|
||||||
channel = "CHANNEL",
|
---@type Message
|
||||||
data = channelname,
|
local msg = {
|
||||||
message = message
|
channel = "CHANNEL",
|
||||||
}
|
data = channelname,
|
||||||
table.insert(shared.messenger.queue, msg)
|
message = message
|
||||||
|
}
|
||||||
|
table.insert(shared.messenger.queue, msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user