[docs] suggest presence in constructor instead of change_presence
This commit is contained in:
parent
954dd09e18
commit
e66141e002
15
docs/faq.rst
15
docs/faq.rst
@ -85,8 +85,15 @@ in the repository.
|
|||||||
How do I set the "Playing" status?
|
How do I set the "Playing" status?
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
There is a method for this under :class:`Client` called :meth:`Client.change_presence`.
|
The ``activity`` keyword argument may be passed in the :class:`Client` constructor or :meth:`Client.change_presence`, given an :class:`Activity` object.
|
||||||
The relevant aspect of this is its ``activity`` keyword argument which takes in 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.
|
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:
|
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: ::
|
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:
|
# or, for watching:
|
||||||
activity = discord.Activity(name='my activity', type=discord.ActivityType.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?
|
How do I send a message to a specific channel?
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Loading…
x
Reference in New Issue
Block a user