Split Game object to separate Activity subtypes for Rich Presences.
This is a massive breaking change. * All references to "game" have been renamed to "activity" * Activity objects contain a majority of the rich presence information * Game and Streaming are subtypes for memory optimisation purposes for the more common cases. * Introduce a more specialised read-only type, Spotify, for the official Spotify integration to make it easier to use.
This commit is contained in:
@ -175,6 +175,24 @@ class Message:
|
||||
Specifies if the message is currently pinned.
|
||||
reactions : List[:class:`Reaction`]
|
||||
Reactions to a message. Reactions can be either custom emoji or standard unicode emoji.
|
||||
activity: Optional[:class:`dict`]
|
||||
The activity associated with this message. Sent with Rich-Presence related messages that for
|
||||
example, request joining, spectating, or listening to or with another member.
|
||||
|
||||
It is a dictionary with the following optional keys:
|
||||
|
||||
- ``type``: An integer denoting the type of message activity being requested.
|
||||
- ``party_id``: The party ID associated with the party.
|
||||
application: Optional[:class:`dict`]
|
||||
The rich presence enabled application associated with this message.
|
||||
|
||||
It is a dictionary with the following keys:
|
||||
|
||||
- ``id``: A string representing the application's ID.
|
||||
- ``name``: A string representing the application's name.
|
||||
- ``description``: A string representing the application's description.
|
||||
- ``icon``: A string representing the icon ID of the application.
|
||||
- ``cover_image``: A string representing the embed's image asset ID.
|
||||
"""
|
||||
|
||||
__slots__ = ( '_edited_timestamp', 'tts', 'content', 'channel', 'webhook_id',
|
||||
@ -182,13 +200,16 @@ class Message:
|
||||
'_cs_channel_mentions', '_cs_raw_mentions', 'attachments',
|
||||
'_cs_clean_content', '_cs_raw_channel_mentions', 'nonce', 'pinned',
|
||||
'role_mentions', '_cs_raw_role_mentions', 'type', 'call',
|
||||
'_cs_system_content', '_cs_guild', '_state', 'reactions' )
|
||||
'_cs_system_content', '_cs_guild', '_state', 'reactions',
|
||||
'application', 'activity' )
|
||||
|
||||
def __init__(self, *, state, channel, data):
|
||||
self._state = state
|
||||
self.id = int(data['id'])
|
||||
self.webhook_id = utils._get_as_snowflake(data, 'webhook_id')
|
||||
self.reactions = [Reaction(message=self, data=d) for d in data.get('reactions', [])]
|
||||
self.application = data.get('application')
|
||||
self.activity = data.get('activity')
|
||||
self._update(channel, data)
|
||||
|
||||
def __repr__(self):
|
||||
@ -242,6 +263,8 @@ class Message:
|
||||
self.channel = channel
|
||||
self._edited_timestamp = utils.parse_time(data.get('edited_timestamp'))
|
||||
self._try_patch(data, 'pinned')
|
||||
self._try_patch(data, 'application')
|
||||
self._try_patch(data, 'activity')
|
||||
self._try_patch(data, 'mention_everyone')
|
||||
self._try_patch(data, 'tts')
|
||||
self._try_patch(data, 'type', lambda x: try_enum(MessageType, x))
|
||||
|
Reference in New Issue
Block a user