12
votes

I am wondering how I can make my bot upload an embedded image to a Discord channel. I know how to make it send embeds, but how do I upload an embedded image? Is it even possible with discord.py? Keep in mind I am not referring to the thumbnail image you can have in an embed image, I am wondering if you even can upload an embed image using Python. Thanks!

1

1 Answers

24
votes

To send an image in an embed, use the set_image method of the embed:

e = discord.Embed()
e.set_image(url="https://discordapp.com/assets/e4923594e694a21542a489471ecffa50.svg")

To send a file from your PC, use the send_file method in async branch or the send method in rewrite branch.

# Async
await bot.send_file(channel, "filepath.png", content="...", filename="...")

# Rewrite
file = discord.File("filepath.png", filename="...")
await channel.send("content", file=file)