Answers for "how to send image discord.py"

9

discord.py send image

await channel.send(file=discord.File('path/to/image.png'))
Posted by: Guest on July-03-2020
0

discord.py send image from url

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'))
Posted by: Guest on May-26-2021

Code answers related to "how to send image discord.py"

Python Answers by Framework

Browse Popular Code Answers by Language