From 2e44a1ef3132c2135d9b972ab79fc612c8746f4b Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Wed, 8 Jan 2025 17:49:22 +0100 Subject: [PATCH] Rework the log messages to not spam on channel message --- Modules/AgentTracker.lua | 23 ++++++++++++++--------- Modules/Commander.lua | 20 +++++++++++++------- Modules/Echoer.lua | 22 +++++++++++++--------- Modules/Emoter.lua | 28 ++++++++++++++++------------ Modules/StinkyTracker.lua | 23 +++++++++++++---------- 5 files changed, 69 insertions(+), 47 deletions(-) diff --git a/Modules/AgentTracker.lua b/Modules/AgentTracker.lua index 6b1b5f6..b6fe630 100644 --- a/Modules/AgentTracker.lua +++ b/Modules/AgentTracker.lua @@ -57,24 +57,29 @@ function shared.AgentTracker.Init() local agentTrackerChannelSniffer = CreateFrame("Frame") agentTrackerChannelSniffer:RegisterEvent("CHAT_MSG_CHANNEL") agentTrackerChannelSniffer:SetScript("OnEvent", function(self, event, msg, sender, ...) - if Heimdall_Data.config.agentTracker.debug then - print(string.format("[%s] Channel message received from: %s", ModuleName, sender)) - end +-- if Heimdall_Data.config.agentTracker.debug then +-- print(string.format("[%s] Channel message received from: %s", ModuleName, sender)) +-- end if not Heimdall_Data.config.agentTracker.enabled then - if Heimdall_Data.config.agentTracker.debug then - print(string.format("[%s] Module disabled, ignoring channel message", ModuleName)) - end +-- if Heimdall_Data.config.agentTracker.debug then +-- print(string.format("[%s] Module disabled, ignoring channel message", ModuleName)) +-- end return end local channelId = select(6, ...) local _, channelname = GetChannelName(channelId) if channelname ~= Heimdall_Data.config.agentTracker.masterChannel then - if Heimdall_Data.config.agentTracker.debug then - print(string.format("[%s] Ignoring message from non-master channel: %s", ModuleName, channelname)) - end +-- if Heimdall_Data.config.agentTracker.debug then +-- print(string.format("[%s] Ignoring message from non-master channel: %s", ModuleName, channelname)) +-- end return end + if Heimdall_Data.config.agentTracker.debug then + print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) + shared.dumpTable(Heimdall_Data.config.agentTracker) + end + sender = string.match(sender, "^[^-]+") local isNewAgent = not Heimdall_Data.config.agents[sender] diff --git a/Modules/Commander.lua b/Modules/Commander.lua index c4f8e63..29f2906 100644 --- a/Modules/Commander.lua +++ b/Modules/Commander.lua @@ -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 diff --git a/Modules/Echoer.lua b/Modules/Echoer.lua index 4c28f15..b49d0d5 100644 --- a/Modules/Echoer.lua +++ b/Modules/Echoer.lua @@ -9,22 +9,22 @@ 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] Channel message received from: %s", ModuleName, sender)) - end +-- if Heimdall_Data.config.echoer.debug then +-- print(string.format("[%s] Channel message received from: %s", ModuleName, sender)) +-- end if not Heimdall_Data.config.echoer.enabled then - if Heimdall_Data.config.echoer.debug then - print(string.format("[%s] Module disabled, ignoring message", ModuleName)) - end +-- if Heimdall_Data.config.echoer.debug then +-- print(string.format("[%s] Module disabled, ignoring message", ModuleName)) +-- end return end local channelId = select(6, ...) local _, channelname = GetChannelName(channelId) - if Heimdall_Data.config.echoer.debug then - print(string.format("[%s] Processing message from channel: %s", ModuleName, channelname)) - end +-- if Heimdall_Data.config.echoer.debug then +-- print(string.format("[%s] Processing message from channel: %s", ModuleName, channelname)) +-- end if channelname ~= Heimdall_Data.config.echoer.masterChannel then if Heimdall_Data.config.echoer.debug then @@ -32,6 +32,10 @@ function shared.Echoer.Init() end return end + if Heimdall_Data.config.echoer.debug then + print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) + shared.dumpTable(Heimdall_Data.config.echoer) + end if string.find(msg, "^" .. Heimdall_Data.config.echoer.prefix) then if Heimdall_Data.config.echoer.debug then diff --git a/Modules/Emoter.lua b/Modules/Emoter.lua index 41b3615..bd89915 100644 --- a/Modules/Emoter.lua +++ b/Modules/Emoter.lua @@ -9,29 +9,33 @@ function shared.Emoter.Init() local frame = CreateFrame("Frame") frame:RegisterEvent("CHAT_MSG_CHANNEL") frame:SetScript("OnEvent", function(self, event, msg, sender, ...) - if Heimdall_Data.config.emoter.debug then - print(string.format("[%s] Channel message received from: %s", ModuleName, sender)) - end +-- if Heimdall_Data.config.emoter.debug then +-- print(string.format("[%s] Channel message received from: %s", ModuleName, sender)) +-- end if not Heimdall_Data.config.emoter.enabled then - if Heimdall_Data.config.emoter.debug then - print(string.format("[%s] Module disabled, ignoring message", ModuleName)) - end +-- if Heimdall_Data.config.emoter.debug then +-- print(string.format("[%s] Module disabled, ignoring message", ModuleName)) +-- end return end local channelId = select(6, ...) local _, channelname = GetChannelName(channelId) - if Heimdall_Data.config.emoter.debug then - print(string.format("[%s] Processing message from channel: %s", ModuleName, channelname)) - end +-- if Heimdall_Data.config.emoter.debug then +-- print(string.format("[%s] Processing message from channel: %s", ModuleName, channelname)) +-- end if channelname ~= Heimdall_Data.config.emoter.masterChannel then - if Heimdall_Data.config.emoter.debug then - print(string.format("[%s] Ignoring message from non-master channel", ModuleName)) - end +-- if Heimdall_Data.config.emoter.debug then +-- print(string.format("[%s] Ignoring message from non-master channel", ModuleName)) +-- end return end + if Heimdall_Data.config.emoter.debug then + print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) + shared.dumpTable(Heimdall_Data.config.emoter) + end if string.find(msg, "^" .. Heimdall_Data.config.emoter.prefix) then if Heimdall_Data.config.emoter.debug then diff --git a/Modules/StinkyTracker.lua b/Modules/StinkyTracker.lua index 5746959..259f8fa 100644 --- a/Modules/StinkyTracker.lua +++ b/Modules/StinkyTracker.lua @@ -95,23 +95,27 @@ function shared.StinkyTracker.Init() local frame = CreateFrame("Frame") frame:RegisterEvent("CHAT_MSG_CHANNEL") frame:SetScript("OnEvent", function(self, event, msg, sender, ...) - if Heimdall_Data.config.stinkyTracker.debug then - print(string.format("[%s] Event received: %s from %s", ModuleName, event, sender)) - end +-- if Heimdall_Data.config.stinkyTracker.debug then +-- print(string.format("[%s] Event received: %s from %s", ModuleName, event, sender)) +-- end if not Heimdall_Data.config.stinkyTracker.enabled then - if Heimdall_Data.config.stinkyTracker.debug then - print(string.format("[%s] Module disabled, ignoring event", ModuleName)) - end +-- if Heimdall_Data.config.stinkyTracker.debug then +-- print(string.format("[%s] Module disabled, ignoring event", ModuleName)) +-- end return end local channelId = select(6, ...) local _, channelname = GetChannelName(channelId) if channelname ~= Heimdall_Data.config.stinkyTracker.masterChannel then - if Heimdall_Data.config.stinkyTracker.debug then - print(string.format("[%s] Ignoring message from non-master channel: %s", ModuleName, channelname)) - end +-- if Heimdall_Data.config.stinkyTracker.debug then +-- print(string.format("[%s] Ignoring message from non-master channel: %s", ModuleName, channelname)) +-- end return end + if Heimdall_Data.config.stinkyTracker.debug then + print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) + shared.dumpTable(Heimdall_Data.config.stinkyTracker) + end if string.find(msg, "^who:") then if Heimdall_Data.config.stinkyTracker.debug then @@ -191,4 +195,3 @@ function shared.StinkyTracker.Init() end print("[Heimdall] StinkyTracker loaded") end -