From 20679dd1c710aa45697127944d5561cb86b11f49 Mon Sep 17 00:00:00 2001 From: Lars Norberg Date: Thu, 19 Oct 2023 14:31:10 +0200 Subject: [PATCH] parse guild achievements, throttle duplicates --- ChatCleaner/Components/Achievements.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ChatCleaner/Components/Achievements.lua b/ChatCleaner/Components/Achievements.lua index 5e57dc8..41393e8 100644 --- a/ChatCleaner/Components/Achievements.lua +++ b/ChatCleaner/Components/Achievements.lua @@ -66,6 +66,16 @@ Module.OnChatEvent = function(self, chatFrame, event, message, author, ...) local player_name, achievement = string_match(message, P[G.ACHIEVEMENT_BROADCAST]) if (player_name and achievement) then + -- Sometime personal achievements are posted + -- both personally and as a guild achievement. + -- We only need to see them once. + if (self.lastMessage == message) then + return true + end + + -- Store the previous achievement message. + self.lastMessage = message + -- kill brackets player_name = string_gsub(player_name, "[%[/%]]", "") achievement = string_gsub(achievement, "[%[/%]]", "") @@ -80,8 +90,10 @@ end Module.OnEnable = function(self) self:RegisterMessageEventFilter("CHAT_MSG_ACHIEVEMENT", onChatEventProxy) + self:RegisterMessageEventFilter("CHAT_MSG_GUILD_ACHIEVEMENT", onChatEventProxy) end Module.OnDisable = function(self) self:UnregisterMessageEventFilter("CHAT_MSG_ACHIEVEMENT", onChatEventProxy) + self:UnregisterMessageEventFilter("CHAT_MSG_GUILD_ACHIEVEMENT", onChatEventProxy) end