📜  discord.py 从 url 发送图像 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:33.084000             🧑  作者: Mango

代码示例1
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'))