aboutsummaryrefslogtreecommitdiff
path: root/discord/message.py
diff options
context:
space:
mode:
authorNadir Chowdhury <[email protected]>2021-04-16 12:33:44 +0100
committerGitHub <[email protected]>2021-04-16 07:33:44 -0400
commitd3ac191a674410ac7a2ae9027315172b15fee6e0 (patch)
tree508bf7643ed36ee4169f3b019efde3e630d94968 /discord/message.py
parent[docs] Fix various unresolved references (diff)
downloaddiscord.py-d3ac191a674410ac7a2ae9027315172b15fee6e0.tar.xz
discord.py-d3ac191a674410ac7a2ae9027315172b15fee6e0.zip
Restrict snowflake regexes to 15-20 digits
Diffstat (limited to 'discord/message.py')
-rw-r--r--discord/message.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/discord/message.py b/discord/message.py
index 51347770..eadd03e5 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -763,21 +763,21 @@ class Message(Hashable):
This allows you to receive the user IDs of mentioned users
even in a private message context.
"""
- return [int(x) for x in re.findall(r'<@!?([0-9]+)>', self.content)]
+ return [int(x) for x in re.findall(r'<@!?([0-9]{15,20})>', self.content)]
@utils.cached_slot_property('_cs_raw_channel_mentions')
def raw_channel_mentions(self):
"""List[:class:`int`]: A property that returns an array of channel IDs matched with
the syntax of ``<#channel_id>`` in the message content.
"""
- return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)]
+ return [int(x) for x in re.findall(r'<#([0-9]{15,20})>', self.content)]
@utils.cached_slot_property('_cs_raw_role_mentions')
def raw_role_mentions(self):
"""List[:class:`int`]: A property that returns an array of role IDs matched with
the syntax of ``<@&role_id>`` in the message content.
"""
- return [int(x) for x in re.findall(r'<@&([0-9]+)>', self.content)]
+ return [int(x) for x in re.findall(r'<@&([0-9]{15,20})>', self.content)]
@utils.cached_slot_property('_cs_channel_mentions')
def channel_mentions(self):