aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-10-17 22:41:20 +0100
committerGravatar Chris Lovering <[email protected]>2024-10-17 22:46:53 +0100
commit5911e10f4502e63541a3ab0603b82caff99dbf3c (patch)
treeae0e04e95488a17f19818cf1722e075dc67ea800
parentMove discord(app) capture to its own optional group in invite regex (diff)
Remove repetition from the invite regex
-rw-r--r--pydis_core/utils/regex.py9
1 files 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<invite>\S+)", # the invite code itself