From c6784ed3d60621ca10882aeabe529b89c6304e06 Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Wed, 26 May 2021 22:29:57 +0200 Subject: [PATCH] Add SimpleChatFilter AddOn. --- SimpleChatFilter/README.md | 2 ++ SimpleChatFilter/SimpleChatFilter.lua | 20 ++++++++++++++++++++ SimpleChatFilter/SimpleChatFilter.toc | 10 ++++++++++ 3 files changed, 32 insertions(+) create mode 100644 SimpleChatFilter/README.md create mode 100644 SimpleChatFilter/SimpleChatFilter.lua create mode 100644 SimpleChatFilter/SimpleChatFilter.toc 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