aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNihaal Sangha <[email protected]>2021-03-03 00:04:03 +0000
committerGitHub <[email protected]>2021-03-02 19:04:03 -0500
commita3f700c11f72202f6a7710ce07c7144a8b8c947d (patch)
tree11671be19992e9dde134eb1b4d652dc5f212b720
parentFix typo with guild_discovery_grace_period_final_warning (diff)
downloaddiscord.py-a3f700c11f72202f6a7710ce07c7144a8b8c947d.tar.xz
discord.py-a3f700c11f72202f6a7710ce07c7144a8b8c947d.zip
Fix references to snowflakes being max 21 long
-rw-r--r--discord/ext/commands/converter.py8
-rw-r--r--discord/utils.py2
-rw-r--r--discord/webhook.py2
3 files changed, 6 insertions, 6 deletions
diff --git a/discord/ext/commands/converter.py b/discord/ext/commands/converter.py
index 89b87f80..850ca728 100644
--- a/discord/ext/commands/converter.py
+++ b/discord/ext/commands/converter.py
@@ -102,7 +102,7 @@ class Converter:
class IDConverter(Converter):
def __init__(self):
- self._id_regex = re.compile(r'([0-9]{15,21})$')
+ self._id_regex = re.compile(r'([0-9]{15,20})$')
super().__init__()
def _get_id_match(self, argument):
@@ -265,11 +265,11 @@ class PartialMessageConverter(Converter):
3. By message URL
"""
def _get_id_matches(self, argument):
- id_regex = re.compile(r'(?:(?P<channel_id>[0-9]{15,21})-)?(?P<message_id>[0-9]{15,21})$')
+ id_regex = re.compile(r'(?:(?P<channel_id>[0-9]{15,20})-)?(?P<message_id>[0-9]{15,20})$')
link_regex = re.compile(
r'https?://(?:(ptb|canary|www)\.)?discord(?:app)?\.com/channels/'
- r'(?:[0-9]{15,21}|@me)'
- r'/(?P<channel_id>[0-9]{15,21})/(?P<message_id>[0-9]{15,21})/?$'
+ r'(?:[0-9]{15,20}|@me)'
+ r'/(?P<channel_id>[0-9]{15,20})/(?P<message_id>[0-9]{15,20})/?$'
)
match = id_regex.match(argument) or link_regex.match(argument)
if not match:
diff --git a/discord/utils.py b/discord/utils.py
index 24428c7a..b99bd70b 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -544,4 +544,4 @@ def escape_mentions(text):
:class:`str`
The text with the mentions removed.
"""
- return re.sub(r'@(everyone|here|[!&]?[0-9]{17,21})', '@\u200b\\1', text)
+ return re.sub(r'@(everyone|here|[!&]?[0-9]{17,20})', '@\u200b\\1', text)
diff --git a/discord/webhook.py b/discord/webhook.py
index bdbc8eff..9b22d42c 100644
--- a/discord/webhook.py
+++ b/discord/webhook.py
@@ -687,7 +687,7 @@ class Webhook(Hashable):
A partial webhook is just a webhook object with an ID and a token.
"""
- m = re.search(r'discord(?:app)?.com/api/webhooks/(?P<id>[0-9]{17,21})/(?P<token>[A-Za-z0-9\.\-\_]{60,68})', url)
+ m = re.search(r'discord(?:app)?.com/api/webhooks/(?P<id>[0-9]{17,20})/(?P<token>[A-Za-z0-9\.\-\_]{60,68})', url)
if m is None:
raise InvalidArgument('Invalid webhook URL given.')
data = m.groupdict()