diff --git a/SimpleChatFilter/README.md b/SimpleChatFilter/README.md new file mode 100644 index 0000000..881ffc1 --- /dev/null +++ b/SimpleChatFilter/README.md @@ -0,0 +1,2 @@ +# SimpleChatFilter +World of Warcraft Classic AddOn to filter annoying spam from the general chat channels. diff --git a/SimpleChatFilter/SimpleChatFilter.lua b/SimpleChatFilter/SimpleChatFilter.lua new file mode 100644 index 0000000..008510f --- /dev/null +++ b/SimpleChatFilter/SimpleChatFilter.lua @@ -0,0 +1,20 @@ +local discardedPatterns = { + "wts.*boost", + "wtb.*boost", + "selling.*boost", + "wtb.*dmt", +} + + +local function simpleChatFilter(chatFrame, event, text, playerName, _, channelName, _, specialFlags, zoneChannelID, channelIndex, channelBaseName, _, lineID, guid) + local textLower = text:lower() + for _, pattern in pairs(discardedPatterns) do + if textLower:find(pattern) then + return true -- discard message + end + end + return false +end + +ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", simpleChatFilter) +print("[|cFFFF7777SimpleChatFilter|r] Discarding|cFFCCCCCC", table.concat(discardedPatterns, " |cFFFF7777|||cFFCCCCCC "), "|r") diff --git a/SimpleChatFilter/SimpleChatFilter.toc b/SimpleChatFilter/SimpleChatFilter.toc new file mode 100644 index 0000000..78d0f4d --- /dev/null +++ b/SimpleChatFilter/SimpleChatFilter.toc @@ -0,0 +1,10 @@ +## Interface: 11305 + +## Title: SimpleChatFilter +## Notes: Simple chat filter. +## Author: Caspervk +## Version: 0.0.1 + +## X-License: GNU General Public License v3 or later (GPLv3+) + +SimpleChatFilter.lua