aboutsummaryrefslogtreecommitdiff
path: root/docs/faq.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/faq.rst')
-rw-r--r--docs/faq.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/faq.rst b/docs/faq.rst
index 8b73357f..bc01eabe 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -134,6 +134,21 @@ To upload multiple files, you can use the ``files`` keyword argument instead of
]
await channel.send(files=my_files)
+If you want to upload something from a URL, you will have to use an HTTP request using ``aiohttp``
+and then pass an ``io.BytesIO`` instance to :class:`File` like so:
+
+.. code-block:: python3
+
+ import io
+ import aiohttp
+
+ async with aiohttp.ClientSession() as session:
+ async with session.get(my_url) as resp:
+ if resp.status != 200:
+ return await channel.send('Could not download file...')
+ data = io.BytesIO(await resp.read())
+ await channel.send(file=discord.File(data, 'cool_image.png'))
+
How can I add a reaction to a message?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~