aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-10-17 22:25:59 +0100
committerGravatar Chris Lovering <[email protected]>2024-10-17 22:46:11 +0100
commite0d6f92b55faf779b71a71a06f6d37cccd97542f (patch)
tree83e759e3bce3ef0d6b096b88f31f217048c41057
parentBump version to v11.4.0 (diff)
Drop / from invite regex fragements
There is already a fragment that captures slashes further down in the regex
-rw-r--r--pydis_core/utils/regex.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/pydis_core/utils/regex.py b/pydis_core/utils/regex.py
index 0901f1f1..13a6d220 100644
--- a/pydis_core/utils/regex.py
+++ b/pydis_core/utils/regex.py
@@ -4,13 +4,14 @@ import re
DISCORD_INVITE = re.compile(
r"(https?://)?(www\.)?" # Optional http(s) and www.
- r"(discord([.,]|dot)gg|" # Could be discord.gg/
- r"discord([.,]|dot)com(/|slash)invite|" # or discord.com/invite/
- r"discordapp([.,]|dot)com(/|slash)invite|" # or discordapp.com/invite/
+ r"(discord([.,]|dot)gg|" # Could be discord.gg
+ r"discord([.,]|dot)com|" # or discord.com/invite
+ r"discordapp([.,]|dot)com|" # or discordapp.com/invite
r"discord([.,]|dot)me|" # or discord.me
r"discord([.,]|dot)li|" # or discord.li
- r"discord([.,]|dot)io|" # or discord.io.
- r"((?<!\w)([.,]|dot))gg" # or .gg/
+ r"discord([.,]|dot)io|" # or discord.io
+ r"((?<!\w)([.,]|dot))gg" # or .gg
+ r"((/|slash|\\)(invite))?" # / or \ or 'slash' invite
r")(/|slash|\\)" # / or \ or 'slash'
r"(?P<invite>\S+)", # the invite code itself
flags=re.IGNORECASE