mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-22 16:51:59 +00:00
[docs] add new FAQ entries
- How to DM - Lack of search and implications - Where to find examples - Getting the ID of a sent message
This commit is contained in:
parent
4c3e53edf4
commit
80702df1bc
29
docs/faq.rst
29
docs/faq.rst
@ -76,6 +76,12 @@ General
|
||||
|
||||
General questions regarding library usage belong here.
|
||||
|
||||
Where can I find usage examples?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Example code can be found in the `examples folder <https://github.com/Rapptz/discord.py/tree/master/examples>`_
|
||||
in the repository.
|
||||
|
||||
How do I set the "Playing" status?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -104,8 +110,29 @@ You must fetch the channel directly and then call the appropriate method. Exampl
|
||||
channel = client.get_channel(12324234183172)
|
||||
await channel.send('hello')
|
||||
|
||||
How do I send a DM?
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Get the :class:`User` or :class:`Member` object and call :meth:`abc.Messageable.send`. For example: ::
|
||||
|
||||
user = client.get_user(381870129706958858)
|
||||
await user.send('👀')
|
||||
|
||||
If you are responding to an event, such as :func:`on_message`, you already have the :class:`User` object via :attr:`Message.author`: ::
|
||||
|
||||
await message.author.send('👋')
|
||||
|
||||
How do I get the ID of a sent message?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
:meth:`abc.Messageable.send` returns the :class:`Message` that was sent.
|
||||
The ID of a message can be accessed via :attr:`Message.id`: ::
|
||||
|
||||
message = await channel.send('hmm…')
|
||||
message_id = message.id
|
||||
|
||||
How do I upload an image?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To upload something to Discord you have to use the :class:`File` object.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user