Add debug options
Add debug buttons Add combatalerter debug
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
local addonname, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
---@cast addonname string
|
||||
local ModuleName = "Echoer"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Echoer = {}
|
||||
@@ -8,25 +9,23 @@ function shared.Echoer.Init()
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||
if Heimdall_Data.config.echoer.debug then
|
||||
print(string.format("%s: OnEvent", ModuleName))
|
||||
shared.dumpTable(Heimdall_Data.config.echoer)
|
||||
end
|
||||
if not Heimdall_Data.config.echoer.enabled then return end
|
||||
|
||||
local channelId = select(6, ...)
|
||||
local channelname = ""
|
||||
---@type any[]
|
||||
local channels = { GetChannelList() }
|
||||
for i = 1, #channels, 2 do
|
||||
---@type number
|
||||
local id = channels[i]
|
||||
---@type string
|
||||
local name = channels[i + 1]
|
||||
if id == channelId then
|
||||
channelname = name
|
||||
end
|
||||
local _, channelname = GetChannelName(channelId)
|
||||
if Heimdall_Data.config.echoer.debug then
|
||||
print(string.format("%s: channelname = %s", ModuleName, channelname))
|
||||
end
|
||||
|
||||
if channelname ~= Heimdall_Data.config.echoer.masterChannel then return end
|
||||
|
||||
if string.find(msg, "^" .. Heimdall_Data.config.echoer.prefix) then
|
||||
if Heimdall_Data.config.echoer.debug then
|
||||
print(string.format("%s: msg = %s", ModuleName, msg))
|
||||
end
|
||||
local msg = string.sub(msg, string.len(Heimdall_Data.config.echoer.prefix) + 1)
|
||||
SendChatMessage(msg, "SAY")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user