diff options
| author | Benjamin Mintz <[email protected]> | 2019-07-23 02:33:02 +0000 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-11-15 04:23:15 -0500 |
| commit | 80702df1bc31181dd10bc9fd3a6e2a722830fbe0 (patch) | |
| tree | 6038a47406239aa5a9e27931ac3d8f99c4695e39 /docs | |
| parent | Fix webhooks not re-raising after retries run out (diff) | |
| download | discord.py-80702df1bc31181dd10bc9fd3a6e2a722830fbe0.tar.xz discord.py-80702df1bc31181dd10bc9fd3a6e2a722830fbe0.zip | |
[docs] add new FAQ entries
- How to DM
- Lack of search and implications
- Where to find examples
- Getting the ID of a sent message
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/faq.rst | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/docs/faq.rst b/docs/faq.rst index c8aeafc8..a4141366 100644 --- a/docs/faq.rst +++ b/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. |