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/state.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/state.py')
| -rw-r--r-- | discord/state.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/discord/state.py b/discord/state.py index d9a53886..731cb096 100644 --- a/discord/state.py +++ b/discord/state.py @@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE. """ from .guild import Guild +from .activity import _ActivityTag from .user import User, ClientUser from .emoji import Emoji, PartialEmoji from .message import Message @@ -67,9 +68,12 @@ class ConnectionState: self.heartbeat_timeout = options.get('heartbeat_timeout', 60.0) self._listeners = [] - game = options.get('game', None) - if game: - game = dict(game) + activity = options.get('activity', None) + if activity: + if not isinstance(activity, _ActivityTag): + raise TypeError('activity parameter must be one of Game, Streaming, or Activity.') + + activity = activity.to_dict() status = options.get('status', None) if status: @@ -78,7 +82,7 @@ class ConnectionState: else: status = str(status) - self._game = game + self._activity = activity self._status = status self.clear() |