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 4
4
Changelog
5
5
=========
6
6
7
+ - :release: `11.7.1 <10th August 2025> `
8
+ - :bug: `304 ` Update Discord invite regex to handle new protocol.
9
+
7
10
- :release: `11.6.1 <13th July 2025> `
8
11
- :bug: `303 ` Update Discord invite regex to handle cases with additional slashes.
9
12
Original file line number Diff line number Diff line change 3
3
import re
4
4
5
5
DISCORD_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
7
9
r"(\B|discord(app)?)" # Optional discord(app)
8
10
r"([.,]|dot)" # Various characters to cover dots
9
11
r"("
Original file line number Diff line number Diff line change 1
1
[tool .poetry ]
2
2
name = " pydis_core"
3
- version = " 11.6 .1"
3
+ version = " 11.7 .1"
4
4
description = " PyDis core provides core functionality and utility to the bots of the Python Discord community."
5
5
authors = [
" Python Discord <[email protected] >" ]
6
6
license = " MIT"
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ def test_discord_invite_positives(self):
49
49
self .assertEqual (search_regex ("https://discord.gg/python with whitespace" ), "python" )
50
50
self .assertEqual (search_regex (" https://discord.gg/python " ), "python" )
51
51
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
+
52
57
def test_discord_invite_negatives (self ):
53
58
"""Test the DISCORD_INVITE regex on a set of strings we would expect to not capture."""
54
59
You can’t perform that action at this time.
0 commit comments