diff options
| author | Rapptz <[email protected]> | 2018-03-05 11:01:46 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-03-05 11:15:49 -0500 |
| commit | f8f8f418f3c51b6a885a1b6b7cd46c38c070b3bc (patch) | |
| tree | 0f26ed361806cf4470b8d98b61f63d2055cf87d0 /discord/message.py | |
| parent | Update docstrings for channel.py (diff) | |
| download | discord.py-f8f8f418f3c51b6a885a1b6b7cd46c38c070b3bc.tar.xz discord.py-f8f8f418f3c51b6a885a1b6b7cd46c38c070b3bc.zip | |
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.
Diffstat (limited to 'discord/message.py')
| -rw-r--r-- | discord/message.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/discord/message.py b/discord/message.py index aef1cb1a..68842a11 100644 --- a/discord/message.py +++ b/discord/message.py @@ -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)) |