aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_core/utils/regex.py
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-08-10 22:23:39 +0100
committerGravatar Joe Banks <[email protected]>2025-08-10 22:25:34 +0100
commitcad2251cbbd9a2a8e8b682795fca7d20c6cbc8d3 (patch)
tree2cec3d03b5f9f6ab2df0f493fc8c8f302973a35e /pydis_core/utils/regex.py
parentRelease version 11.6.1 (diff)
Update Regex to include Discord protocol format (#304)
Chris is traveling abroad and is unable to access. Therefore, Fisher have become his proxy. An 'apprentice' if you will. Shame because Fisher have years more software engineering experience compared to him. Unfortunately, neither Fisher nor Chris cared to separate the version bump into a separate commit so SENIOR Engineer Joe Banks to JUNIOR Engineer Chris Lovering with INTERN Fisher has had to Get Involved. Co-authored-by: ChrisLovering <[email protected]> Co-authored-by: fisher60 <[email protected]>
Diffstat (limited to 'pydis_core/utils/regex.py')
-rw-r--r--pydis_core/utils/regex.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pydis_core/utils/regex.py b/pydis_core/utils/regex.py
index ba6b9b01..26b1a547 100644
--- a/pydis_core/utils/regex.py
+++ b/pydis_core/utils/regex.py
@@ -3,14 +3,16 @@
import re
DISCORD_INVITE = re.compile(
- r"(https?:\/\/)?(www\.)?" # Optional http(s) and www.
+ r"(https?:\/\/)?(discord:\/*)?" # Optional protocols
+ r"(www\.)?" # Optional www
+ r"[@#]*" # Optional @ or # symbols
r"(\B|discord(app)?)" # Optional discord(app)
r"([.,]|dot)" # Various characters to cover dots
r"("
r"(gg|me)" # TLDs that embed within discord
r"|com(\/|slash|\\)invite" # Only match com/invite
r")"
- r"(/|slash|\\+)" # / or 'slash' or 1+ of \
+ r"(/|slash|\\+)" # / or 'slash' or 1+ of \
r"(?P<invite>\S+)", # the invite code itself
flags=re.IGNORECASE
)