aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMikey <[email protected]>2021-03-31 18:26:51 -0700
committerGitHub <[email protected]>2021-03-31 21:26:51 -0400
commite66141e002877bc1362a9e7fc0dda4d539d76bc1 (patch)
tree5785aae9a5a83f6a15145bfaf46713a650a5985c /docs
parentDeprecate Client.logout (diff)
downloaddiscord.py-e66141e002877bc1362a9e7fc0dda4d539d76bc1.tar.xz
discord.py-e66141e002877bc1362a9e7fc0dda4d539d76bc1.zip
[docs] suggest presence in constructor instead of change_presence
Diffstat (limited to 'docs')
-rw-r--r--docs/faq.rst15
1 files changed, 11 insertions, 4 deletions
diff --git a/docs/faq.rst b/docs/faq.rst
index 55a65239..643fc385 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -85,8 +85,15 @@ in the repository.
How do I set the "Playing" status?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-There is a method for this under :class:`Client` called :meth:`Client.change_presence`.
-The relevant aspect of this is its ``activity`` keyword argument which takes in an :class:`Activity` object.
+The ``activity`` keyword argument may be passed in the :class:`Client` constructor or :meth:`Client.change_presence`, given an :class:`Activity` object.
+
+The constructor may be used for static activities, while :meth:`Client.change_presence` may be used to update the activity at runtime.
+
+.. warning::
+
+ It is highly discouraged to use :meth:`Client.change_presence` or API calls in :func:`on_ready` as this event may be called many times while running, not just once.
+
+ There is a high chance of disconnecting if presences are changed right after connecting.
The status type (playing, listening, streaming, watching) can be set using the :class:`ActivityType` enum.
For memory optimisation purposes, some activities are offered in slimmed down versions:
@@ -96,11 +103,11 @@ For memory optimisation purposes, some activities are offered in slimmed down ve
Putting both of these pieces of info together, you get the following: ::
- await client.change_presence(activity=discord.Game(name='my game'))
+ client = discord.Client(activity=discord.Game(name='my game'))
# or, for watching:
activity = discord.Activity(name='my activity', type=discord.ActivityType.watching)
- await client.change_presence(activity=activity)
+ client = discord.Client(activity=activity)
How do I send a message to a specific channel?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~