mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-12 16:59:50 +00:00
Change regex from \d+ to [0-9]+ for performance reasons.
\d+ includes unicode characters while [0-9]+ doesn't.
This commit is contained in:
parent
4f66d41ca3
commit
ebcb532c38
@ -206,7 +206,7 @@ class Client:
|
|||||||
if isinstance(mentions, list):
|
if isinstance(mentions, list):
|
||||||
return [user.id for user in mentions]
|
return [user.id for user in mentions]
|
||||||
elif mentions == True:
|
elif mentions == True:
|
||||||
return re.findall(r'<@(\d+)>', content)
|
return re.findall(r'<@([0-9]+)>', content)
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class Message(object):
|
|||||||
This allows you receive the user IDs of mentioned users
|
This allows you receive the user IDs of mentioned users
|
||||||
even in a private message context.
|
even in a private message context.
|
||||||
"""
|
"""
|
||||||
return re.findall(r'<@(\d+)>', self.content)
|
return re.findall(r'<@([0-9]+)>', self.content)
|
||||||
|
|
||||||
@utils.cached_property
|
@utils.cached_property
|
||||||
def raw_channel_mentions(self):
|
def raw_channel_mentions(self):
|
||||||
@ -142,7 +142,7 @@ class Message(object):
|
|||||||
This allows you receive the channel IDs of mentioned users
|
This allows you receive the channel IDs of mentioned users
|
||||||
even in a private message context.
|
even in a private message context.
|
||||||
"""
|
"""
|
||||||
return re.findall(r'<#(\d+)>', self.content)
|
return re.findall(r'<#([0-9]+)>', self.content)
|
||||||
|
|
||||||
def _handle_upgrades(self, channel_id):
|
def _handle_upgrades(self, channel_id):
|
||||||
self.server = None
|
self.server = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user