aboutsummaryrefslogtreecommitdiff
path: root/discord/message.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-10-10 20:09:06 -0400
committerRapptz <[email protected]>2017-01-03 09:51:49 -0500
commit45c729b167509deb5e389a7812d0ae8f4cbc4e72 (patch)
tree5617af109edb3d7b7fb0e28934bf57e4f664f362 /discord/message.py
parentRemove Message.timestamp and make Message.channel_mentions lazy. (diff)
downloaddiscord.py-45c729b167509deb5e389a7812d0ae8f4cbc4e72.tar.xz
discord.py-45c729b167509deb5e389a7812d0ae8f4cbc4e72.zip
Switch IDs to use int instead of str
Diffstat (limited to 'discord/message.py')
-rw-r--r--discord/message.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/discord/message.py b/discord/message.py
index 9497c2b2..28ab18d1 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -95,9 +95,9 @@ class Message:
role_mentions: list
A list of :class:`Role` that were mentioned. If the message is in a private message
then the list is always empty.
- id: str
+ id: int
The message ID.
- webhook_id: Optional[str]
+ webhook_id: Optional[int]
If this message was sent by a webhook, then this is the webhook ID's that sent this
message.
attachments: list
@@ -163,7 +163,7 @@ class Message:
return
for mention in mentions:
- id_search = mention['id']
+ id_search = int(mention['id'])
member = self.server.get_member(id_search)
if member is not None:
self.mentions.append(member)
@@ -185,7 +185,7 @@ class Message:
# the author
participants = []
- for uid in call.get('participants', []):
+ for uid in map(int, call.get('participants', [])):
if uid == self.author.id:
participants.append(self.author)
else:
@@ -204,21 +204,21 @@ class Message:
This allows you receive the user IDs of mentioned users
even in a private message context.
"""
- return re.findall(r'<@!?([0-9]+)>', self.content)
+ return [int(x) for x in re.findall(r'<@!?([0-9]+)>', self.content)]
@utils.cached_slot_property('_cs_raw_channel_mentions')
def raw_channel_mentions(self):
"""A property that returns an array of channel IDs matched with
the syntax of <#channel_id> in the message content.
"""
- return re.findall(r'<#([0-9]+)>', self.content)
+ return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)]
@utils.cached_slot_property('_cs_raw_role_mentions')
def raw_role_mentions(self):
"""A property that returns an array of role IDs matched with
the syntax of <@&role_id> in the message content.
"""
- return re.findall(r'<@&([0-9]+)>', self.content)
+ return [int(x) for x in re.findall(r'<@&([0-9]+)>', self.content)]
@utils.cached_slot_property('_cs_channel_mentions')
def channel_mentions(self):