mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-16 18:59:09 +00:00
Support for pinned system messages.
This commit is contained in:
parent
1a0182e6eb
commit
da986b2d7c
@ -42,6 +42,7 @@ class MessageType(Enum):
|
|||||||
call = 3
|
call = 3
|
||||||
channel_name_change = 4
|
channel_name_change = 4
|
||||||
channel_icon_change = 5
|
channel_icon_change = 5
|
||||||
|
pins_add = 6
|
||||||
|
|
||||||
class ServerRegion(Enum):
|
class ServerRegion(Enum):
|
||||||
us_west = 'us-west'
|
us_west = 'us-west'
|
||||||
|
@ -295,6 +295,9 @@ class Message:
|
|||||||
if self.type is MessageType.default:
|
if self.type is MessageType.default:
|
||||||
return self.content
|
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:
|
if self.type is MessageType.recipient_add:
|
||||||
return '{0.name} added {1.name} to the group.'.format(self.author, self.mentions[0])
|
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:
|
if self.type is MessageType.channel_icon_change:
|
||||||
return '{0.author.name} changed the channel icon.'.format(self)
|
return '{0.author.name} changed the channel icon.'.format(self)
|
||||||
|
|
||||||
# we're at the call message type now, which is a bit more complicated.
|
if self.type is MessageType.call:
|
||||||
# we can make the assumption that Message.channel is a PrivateChannel
|
# we're at the call message type now, which is a bit more complicated.
|
||||||
# with the type ChannelType.group or ChannelType.private
|
# we can make the assumption that Message.channel is a PrivateChannel
|
||||||
call_ended = self.call.ended_timestamp is not None
|
# 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:
|
if self.channel.me in self.call.participants:
|
||||||
return '{0.author.name} started a call.'.format(self)
|
return '{0.author.name} started a call.'.format(self)
|
||||||
elif call_ended:
|
elif call_ended:
|
||||||
return 'You missed a call from {0.author.name}'.format(self)
|
return 'You missed a call from {0.author.name}'.format(self)
|
||||||
else:
|
else:
|
||||||
return '{0.author.name} started a call \N{EM DASH} Join the call.'.format(self)
|
return '{0.author.name} started a call \N{EM DASH} Join the call.'.format(self)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user