From 69bc65b19150039108a1619e243d9aaea9a04a0b Mon Sep 17 00:00:00 2001 From: vivekashok1221 Date: Thu, 28 Mar 2024 15:30:57 +0400 Subject: Use regex to detect Discord invite link --- bot/exts/filtering/_ui/ui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/exts/filtering/_ui/ui.py b/bot/exts/filtering/_ui/ui.py index 49f4614c7..e6c39dc75 100644 --- a/bot/exts/filtering/_ui/ui.py +++ b/bot/exts/filtering/_ui/ui.py @@ -16,6 +16,7 @@ from pydis_core.site_api import ResponseCodeError from pydis_core.utils import scheduling from pydis_core.utils.logging import get_logger from pydis_core.utils.members import get_or_fetch_member +from pydis_core.utils.regex import DISCORD_INVITE import bot from bot.constants import Colours @@ -685,7 +686,7 @@ class AlertView(discord.ui.View): return "", None if content_list: current_content = next(iter(content_list)) - if filter_list.name == "domain" and "discord.gg" in current_content: + if filter_list.name == "domain" and re.fullmatch(DISCORD_INVITE, current_content): # Leave invites to the invite filterlist. continue if encountered: -- cgit v1.2.3