]> PatchyGit - patchyircd.git/commitdiff
spam.lua: add more pm filters
authorEgor <egor@patchysicp.xyz>
Sat, 17 Aug 2024 21:29:43 +0000 (00:29 +0300)
committerEgor <egor@patchysicp.xyz>
Sat, 17 Aug 2024 21:29:43 +0000 (00:29 +0300)
lua/spam.lua

index bac32e9..ec8ea57 100644 (file)
@@ -12,16 +12,46 @@ function setspamlevel(newlevel)
                if cl1.umode & 2 ~= 0 then -- UMODE_OPER
                        return 0
                end
+               if cl1.umode & 8 ~= 0 then -- UMODE_REGISTERED
+                       return 0
+               end
                txt = ascii(txt)
                if not chan.v[cl1.key] and not chan.o[cl1.key] and
                        txt:find("irc.supernets.org", 1, true) then
                        return -1
                end
        end)
+       hook_add("sendtochannel", "supernets_pm_filter", spamlevel >= 10 and function(hook, cl1, cl2, chan, txt)
+               if cl1.umode & 2 ~= 0 then -- UMODE_OPER
+                       return 0
+               end
+               if cl1.umode & 8 ~= 0 then -- UMODE_REGISTERED
+                       return 0
+               end
+               txt = ascii(txt)
+               if txt:find("irc.supernets.org", 1, true) then
+                       return -1
+               end
+       end)
        hook_add("sendtochannel", "hardchats_filter", spamlevel >= 10 and function(hook, cl1, cl2, chan, txt)
                if cl1.umode & 2 ~= 0 then -- UMODE_OPER
                        return 0
                end
+               if cl1.umode & 8 ~= 0 then -- UMODE_REGISTERED
+                       return 0
+               end
+               txt = ascii(txt)
+               if txt:find("hardchats.com", 1, true) or txt:find("hardchat", 1, true) then
+                       return -1
+               end
+       end)
+       hook_add("sendtoclinet", "hardchats_pm_filter", spamlevel >= 10 and function(hook, cl1, cl2, chan, txt)
+               if cl1.umode & 2 ~= 0 then -- UMODE_OPER
+                       return 0
+               end
+               if cl1.umode & 8 ~= 0 then -- UMODE_REGISTERED
+                       return 0
+               end
                txt = ascii(txt)
                if not chan.v[cl1.key] and not chan.o[cl1.key] and
                        (txt:find("hardchats.com", 1, true) or txt:find("hardchat", 1, true)) then