]> PatchyGit - patchyircd.git/commitdiff
spam.lua: block some dumb podcast guy
authorEgor <egor@patchysicp.xyz>
Mon, 27 May 2024 09:32:14 +0000 (12:32 +0300)
committerEgor <egor@patchysicp.xyz>
Mon, 27 May 2024 09:32:14 +0000 (12:32 +0300)
lua/spam.lua

index 749c4b5..1f6a606 100644 (file)
@@ -13,6 +13,29 @@ function setspamlevel(newlevel)
                        return -1
                end
        end)
+       hook_add("sendtochannel", "l0de_radio_hour_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
+               if not chan.v[cl1.key] and not chan.o[cl1.key] and
+                       (txt:find("1-877-293-1933", 1, true)) then
+                       return -1
+               end
+       end)
+       hook_add("sendtoclient", "l0de_radio_hour_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
+               if txt:find("1-877-293-1933", 1, true) then
+                       return -1
+               end
+       end)
        hook_add("sendtoclient", "no_unsolicited_pm", spamlevel >= 20 and function(hook, cl1, cl2, chan, txt)
                if cl1.umode & 2 ~= 0 then -- UMODE_OPER
                        return 0