wow-addons/SimpleChatFilter/SimpleChatFilter.lua

21 lines
679 B
Lua
Raw Permalink Normal View History

2021-05-26 22:29:57 +02:00
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")