Rework the log messages to not spam on channel message

This commit is contained in:
2025-01-08 17:49:22 +01:00
parent d182cc1418
commit 2e44a1ef31
5 changed files with 69 additions and 47 deletions

View File

@@ -212,20 +212,26 @@ function shared.Commander.Init()
local commanderChannelFrame = CreateFrame("Frame")
commanderChannelFrame:RegisterEvent("CHAT_MSG_CHANNEL")
commanderChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Event received", ModuleName))
shared.dumpTable(Heimdall_Data.config.commander)
-- if Heimdall_Data.config.commander.debug then
-- print(string.format("[%s] Event received", ModuleName))
-- shared.dumpTable(Heimdall_Data.config.commander)
-- end
if not Heimdall_Data.config.commander.enabled then
-- if Heimdall_Data.config.commander.debug then
-- print(string.format("[%s] Module disabled, ignoring event", ModuleName))
-- end
return
end
if not Heimdall_Data.config.commander.enabled then return end
local channelId = select(6, ...)
local _, channelname = GetChannelName(channelId)
if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Channel received: %s", ModuleName, channelname))
end
-- if Heimdall_Data.config.commander.debug then
-- print(string.format("[%s] Channel received: %s", ModuleName, channelname))
-- end
if channelname ~= Heimdall_Data.config.commander.masterChannel then return end
sender = string.match(sender, "^[^-]+")
if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Message from: %s", ModuleName, sender))
shared.dumpTable(Heimdall_Data.config.commander)
end
for _, command in ipairs(commands) do