diff options
| author | Rapptz <[email protected]> | 2015-12-16 23:46:02 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-12-16 23:46:02 -0500 |
| commit | ebcb532c38be49853ed1b7fc240de034b4cef1a9 (patch) | |
| tree | bad1175fbc847fa4bf08f5f9db6e9346af34958c /discord/message.py | |
| parent | Add Server.me attribute to access the Member version of Client.user. (diff) | |
| download | discord.py-ebcb532c38be49853ed1b7fc240de034b4cef1a9.tar.xz discord.py-ebcb532c38be49853ed1b7fc240de034b4cef1a9.zip | |
Change regex from \d+ to [0-9]+ for performance reasons.
\d+ includes unicode characters while [0-9]+ doesn't.
Diffstat (limited to 'discord/message.py')
| -rw-r--r-- | discord/message.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/discord/message.py b/discord/message.py index f4ff0586..f259032d 100644 --- a/discord/message.py +++ b/discord/message.py @@ -132,7 +132,7 @@ class Message(object): This allows you receive the user IDs of mentioned users even in a private message context. """ - return re.findall(r'<@(\d+)>', self.content) + return re.findall(r'<@([0-9]+)>', self.content) @utils.cached_property def raw_channel_mentions(self): @@ -142,7 +142,7 @@ class Message(object): This allows you receive the channel IDs of mentioned users 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): self.server = None |