diff options
| author | Rapptz <[email protected]> | 2016-09-12 20:22:53 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-09-12 20:22:53 -0400 |
| commit | da986b2d7c4fa85239b33b9cddae8348b9ecb35b (patch) | |
| tree | ffcb12f35d864aa001a011e09fed28d492576862 /discord/message.py | |
| parent | Fix import for Object.created_at (diff) | |
| download | discord.py-da986b2d7c4fa85239b33b9cddae8348b9ecb35b.tar.xz discord.py-da986b2d7c4fa85239b33b9cddae8348b9ecb35b.zip | |
Support for pinned system messages.
Diffstat (limited to 'discord/message.py')
| -rw-r--r-- | discord/message.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/discord/message.py b/discord/message.py index 30929a2c..0413424e 100644 --- a/discord/message.py +++ b/discord/message.py @@ -295,6 +295,9 @@ class Message: if self.type is MessageType.default: return self.content + if self.type is MessageType.pins_add: + return '{0.name} pinned a message to this channel.'.format(self.author) + if self.type is MessageType.recipient_add: return '{0.name} added {1.name} to the group.'.format(self.author, self.mentions[0]) @@ -307,14 +310,15 @@ class Message: if self.type is MessageType.channel_icon_change: return '{0.author.name} changed the channel icon.'.format(self) - # we're at the call message type now, which is a bit more complicated. - # we can make the assumption that Message.channel is a PrivateChannel - # with the type ChannelType.group or ChannelType.private - call_ended = self.call.ended_timestamp is not None - - if self.channel.me in self.call.participants: - return '{0.author.name} started a call.'.format(self) - elif call_ended: - return 'You missed a call from {0.author.name}'.format(self) - else: - return '{0.author.name} started a call \N{EM DASH} Join the call.'.format(self) + if self.type is MessageType.call: + # we're at the call message type now, which is a bit more complicated. + # we can make the assumption that Message.channel is a PrivateChannel + # with the type ChannelType.group or ChannelType.private + call_ended = self.call.ended_timestamp is not None + + if self.channel.me in self.call.participants: + return '{0.author.name} started a call.'.format(self) + elif call_ended: + return 'You missed a call from {0.author.name}'.format(self) + else: + return '{0.author.name} started a call \N{EM DASH} Join the call.'.format(self) |