From 5911e10f4502e63541a3ab0603b82caff99dbf3c Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 17 Oct 2024 22:41:20 +0100 Subject: Remove repetition from the invite regex --- pydis_core/utils/regex.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pydis_core/utils/regex.py b/pydis_core/utils/regex.py index f78229ff..a78f2afb 100644 --- a/pydis_core/utils/regex.py +++ b/pydis_core/utils/regex.py @@ -5,13 +5,8 @@ import re DISCORD_INVITE = re.compile( r"(https?://)?(www\.)?" # Optional http(s) and www. r"(discord(app)?)?" # Optional discord(app) - r"(" - r"([.,]|dot)gg|" # Could be .gg - r"([.,]|dot)com|" # or .com - r"([.,]|dot)me|" # or .me - r"([.,]|dot)li|" # or .li - r"([.,]|dot)io" # or .io - r")" + r"([.,]|dot)" # Various characters to cover dots + r"(gg|com|me|li|io)" # A few TLDs that embed within discord r"((/|slash|\\)(invite))?" # / or \ or 'slash' invite r"(/|slash|\\)" # / or \ or 'slash' r"(?P\S+)", # the invite code itself -- cgit v1.2.3