File tree Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 44 Changelog
55=========
66
7+ - :release: `11.7.1 <10th August 2025> `
8+ - :bug: `304 ` Update Discord invite regex to handle new protocol.
9+
710- :release: `11.6.1 <13th July 2025> `
811- :bug: `303 ` Update Discord invite regex to handle cases with additional slashes.
912
Original file line number Diff line number Diff line change 33import re
44
55DISCORD_INVITE = re .compile (
6- r"(https?:\/\/)?(www\.)?" # Optional http(s) and www.
6+ r"(https?:\/\/)?(discord:\/*)?" # Optional protocols
7+ r"(www\.)?" # Optional www
8+ r"[@#]{0,2}" # Optional @ or # symbols
79 r"(\B|discord(app)?)" # Optional discord(app)
810 r"([.,]|dot)" # Various characters to cover dots
911 r"("
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " pydis_core"
3- version = " 11.6 .1"
3+ version = " 11.7 .1"
44description = " PyDis core provides core functionality and utility to the bots of the Python Discord community."
55authors = [" Python Discord <info@pythondiscord.com>" ]
66license = " MIT"
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ def test_discord_invite_positives(self):
4949 self .assertEqual (search_regex ("https://discord.gg/python with whitespace" ), "python" )
5050 self .assertEqual (search_regex (" https://discord.gg/python " ), "python" )
5151
52+ self .assertEqual (search_regex ("discord:#@discordapp.com/invite/python" ), "python" )
53+ self .assertEqual (search_regex ("discord:/#@discordapp.com/invite/python" ), "python" )
54+ self .assertEqual (search_regex ("discord://#@discordapp.com/invite/python" ), "python" )
55+ self .assertEqual (search_regex ("discord://@#discordapp.com/invite/python" ), "python" )
56+
5257 def test_discord_invite_negatives (self ):
5358 """Test the DISCORD_INVITE regex on a set of strings we would expect to not capture."""
5459
You can’t perform that action at this time.
0 commit comments