aboutsummaryrefslogtreecommitdiff
path: root/discord/message.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-18 02:09:50 -0400
committerRapptz <[email protected]>2016-06-18 02:14:44 -0400
commitb3edb31df5500e8e850450577e9541af07a9508b (patch)
treeb171f6c152a889d26395dc46ea66176780d4556c /discord/message.py
parentFix HTTPClient.recreate to actually work. (diff)
downloaddiscord.py-b3edb31df5500e8e850450577e9541af07a9508b.tar.xz
discord.py-b3edb31df5500e8e850450577e9541af07a9508b.zip
Add support for message pinning.
This includes `Client.pin_message`, `Client.unpin_message` and `Client.pins_from`. This also adds the `Message.pinned` attribute to the `Message` object.
Diffstat (limited to 'discord/message.py')
-rw-r--r--discord/message.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/discord/message.py b/discord/message.py
index ea7bfd64..93d33f8a 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -90,12 +90,14 @@ class Message:
The message ID.
attachments : list
A list of attachments given to a message.
+ pinned: bool
+ Specifies if the message is currently pinned.
"""
__slots__ = [ 'edited_timestamp', 'timestamp', 'tts', 'content', 'channel',
'mention_everyone', 'embeds', 'id', 'mentions', 'author',
'channel_mentions', 'server', '_raw_mentions', 'attachments',
- '_clean_content', '_raw_channel_mentions', 'nonce',
+ '_clean_content', '_raw_channel_mentions', 'nonce', 'pinned',
'role_mentions', '_raw_role_mentions' ]
def __init__(self, **kwargs):
@@ -108,7 +110,8 @@ class Message:
# sometimes the .%f modifier is missing
self.edited_timestamp = utils.parse_time(data.get('edited_timestamp'))
self.timestamp = utils.parse_time(data.get('timestamp'))
- self.tts = data.get('tts')
+ self.tts = data.get('tts', False)
+ self.pinned = data.get('pinned', False)
self.content = data.get('content')
self.mention_everyone = data.get('mention_everyone')
self.embeds = data.get('embeds')