diff options
| author | Rapptz <[email protected]> | 2018-03-05 11:23:07 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-03-05 11:23:07 -0500 |
| commit | 0fcd385b9abc9f824c554600a0e7a29baa7c881e (patch) | |
| tree | 301dc6860962b39d5840d3cea60b0910fb0cde46 | |
| parent | Split Game object to separate Activity subtypes for Rich Presences. (diff) | |
| download | discord.py-0fcd385b9abc9f824c554600a0e7a29baa7c881e.tar.xz discord.py-0fcd385b9abc9f824c554600a0e7a29baa7c881e.zip | |
Add ability to change the activity used when logging in at runtime.
| -rw-r--r-- | discord/client.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/discord/client.py b/discord/client.py index bd4c35e9..e8309f1c 100644 --- a/discord/client.py +++ b/discord/client.py @@ -584,6 +584,20 @@ class Client: """:obj:`bool`: Indicates if the websocket connection is closed.""" return self._closed.is_set() + @property + def activity(self): + """Optional[Union[:class:`Activity`, :class:`Game`, :class:`Streaming`]]: The activity being used upon logging in.""" + return self._connection._activity + + @activity.setter + def activity(self, value): + if value is None: + self._connection._activity = None + elif isinstance(value, _ActivityTag): + self._connection._activity = value.to_dict() + else: + raise TypeError('activity must be one of Game, Streaming, or Activity.') + # helpers/getters @property |