mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-04 08:56:19 +00:00
Update to support new pin endpoints
This commit is contained in:
@ -2185,6 +2185,7 @@ class Message(PartialMessage, Hashable):
|
||||
'call',
|
||||
'purchase_notification',
|
||||
'message_snapshots',
|
||||
'_pinned_at',
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -2224,6 +2225,8 @@ class Message(PartialMessage, Hashable):
|
||||
self.application_id: Optional[int] = utils._get_as_snowflake(data, 'application_id')
|
||||
self.stickers: List[StickerItem] = [StickerItem(data=d, state=state) for d in data.get('sticker_items', [])]
|
||||
self.message_snapshots: List[MessageSnapshot] = MessageSnapshot._from_value(state, data.get('message_snapshots'))
|
||||
# Set by Messageable.pins
|
||||
self._pinned_at: Optional[datetime.datetime] = None
|
||||
|
||||
self.poll: Optional[Poll] = None
|
||||
try:
|
||||
@ -2644,6 +2647,18 @@ class Message(PartialMessage, Hashable):
|
||||
# Fall back to guild threads in case one was created after the message
|
||||
return self._thread or self.guild.get_thread(self.id)
|
||||
|
||||
@property
|
||||
def pinned_at(self) -> Optional[datetime.datetime]:
|
||||
"""Optional[:class:`datetime.datetime`]: An aware UTC datetime object containing the time
|
||||
when the message was pinned.
|
||||
|
||||
.. note::
|
||||
This is only set for messages that are returned by :meth:`abc.Messageable.pins`.
|
||||
|
||||
.. versionadded:: 2.6
|
||||
"""
|
||||
return self._pinned_at
|
||||
|
||||
@property
|
||||
@deprecated('interaction_metadata')
|
||||
def interaction(self) -> Optional[MessageInteraction]:
|
||||
|
Reference in New Issue
Block a user