-- Change this if your language uses a lot of accented letters
SSAccentScore = 0.5
SS = {}
SSBlocked = {
}
SSBlockedReason = {
}
SSLastMessages = {
}
-- these are always spam, 100% of the time
SS.blackList = {
"$%d+.+%d+g", -- mwatches $9.99
"%d+g.+$%d+", -- matches 5g $9
"%d+e.?u.?r.+%d+g", -- matches 9eu(r) 5g
"%d+g.+%d+e.?u.?r", -- matches 5g 9eu(r)
"%d+g.+e.?u.?r%d+", -- matches 5g eur 5 (utf8 scrambled)
"\226\130\172%d+.+%d+g", -- matches €9 5g
"%d+g.+\226\130\172%d+", -- matches 5g €9
"\194\163%d+.+%d+g", -- matches £9 10g
"%d+g.+\194\163%d+", -- matches 10g £9
"s.?k.?y.?p.?e?", -- matches skype under almost all obfuscation's
"s.?k.?p.?y.?e?", -- matches skype under almost all obfuscation's
"anal", -- anal [gtfo]
}
-- on english speaking realms, these characters are very very rare
-- and are mostly used to try and get around spam blockers
SS.obfs = {
"å","à","á","ä","â","ã",
"è","é","ë","ê",
"ì","í","ï","î",
"ò","ó","ö","ô","õ",
"ù","ú","ü","û",
"¥",
"{square}","{star}","{triangle}","{circle}","{skull}","{diamond}"
}
-- guild spamming sucks
SS.guildList = {
"recruiting",
"recruit",
"level 25",
"L25",
"Level25"
}
-- words that could be bad, but also have a legit usage
-- these are given a lower weight
SS.greyList = {
"dollar", "pounds", "usd", "gbp",
"www", "[,.]com", "[,.]corn", "[,.]conn", "[,.]c0m", "[,.]c0rn", "[,.]c0nn", "dotcom","cRT2m","[,.]cqm","vvwwvv",
"anytime",
"mins",
"welcome",
"cheap",
"buy", "kauf",
"delivery",
"discount", "rabatt",
"peons",
"185", "1-85",
"525", "1-525",
"gold",
"%dkgold",
"%dgold",
"payment",
"bucks",
"safe",
"greatest",
"sale",
"statchanger",
"hack",
"20,000",
"100,000",
"eur",
"code",
"bonus",
"stock",
"company",
"super",
"price",
-- people selling arena shit
"ranking",
"arena",
"selling",
"best",
"get the",
"the best",
-- mounts, no one has more than 1 or 2 of these so 3+ good bets is a spammer
"swift shorestrider",
"amani dragonhawk",
"savage raptor",
"mottled drake",
"wooly white rhino",
"blazing hippogryph",
"big battle bear",
"reins of the swift spectral tiger",
"vial of the sands",
"x-53 touring rocket",
-- other bop or achiv selling
"boe",
"reliable",
"company",
"sell",
"service",
"services",
"shareing", -- lol they can't spell
"sharing",
"account",
"accounts",
"hot",
"transfer",
}
function SS.Check(sender)
for _, name in pairs(SSBlocked) do
if name == sender then
return true
end
end
return false
end
function SS.SimpleSpam(self, event, msg, ...)
local matchCount = 0
local msgOrig = msg
local sender = select(4,...)
local line = select(10,...)
local reason = false
msg = strlower(msg)
-- no double spam
if msg == SSLastMessage then
return true
end
-- blacklist
for _, word in ipairs(SS.blackList) do
if (string.match(msg, word)) then
matchCount = matchCount + 4.0
end
end
-- greylist
for _, word in ipairs(SS.greyList) do
if (string.match(msg, word)) then
matchCount = matchCount + 1.0
end
end
-- obfuscated characters
for _, word in ipairs(SS.obfs) do
if (string.match(msg, word)) then
matchCount = matchCount + SSAccentScore
end
end
-- guild spam
for _, word in ipairs(SS.guildList) do
if (string.match(msg, word)) then
matchCount = matchCount + 1.5
end
end
-- English only please
if select(2, string.gsub(msg, "[a-zA-Z0-9.]", ".")) < (#msg/2) and #msg >= 4 then
return true -- don't ban for non english. ignore it
end
-- block if more than 3 points
if (matchCount >= 3) then
if SS.Check(sender) == false and matchCount >= 4.5 then
table.insert(SSBlocked, sender)
SSBlockedReason[sender] = msgOrig
if reason then
print("|cffBA2323Blocked spam from " .. sender .. ". " .. reason .. "|r")
else
print("|cffBA2323Blocked spam from " .. sender .. ". Violation Score of " .. matchCount .. "|r")
end
end
return true
else
SSLastMessage = msg
return false
end
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", SS.SimpleSpam)
ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", SS.SimpleSpam)
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", SS.SimpleSpam)
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", SS.SimpleSpam)