1

I embed a image using this code, it doesn't throw any error and it send a embed but nothing is there in the embed.

e=discord.Embed()
file = discord.File("OWO.jpg", filename="OWO.jpg")
e.set_thumbnail(url="attachment://OWO.jpg")
msg = ctx.send(embed=e)

This is my embed image look like, There's nothing in it.

y_159
  • 458
  • 3
  • 15
cutebear
  • 25
  • 2
  • 8

2 Answers2

2

How do I use a local image file for an embed image?

Discord special-cases uploading an image attachment and using it within an embed so that it will not display separately, but instead in the embed’s thumbnail, image, footer or author icon.

To do so, upload the image normally with abc.Messageable.send(), and set the embed’s image URL to attachment://image.png, where image.png is the filename of the image you will send.

Quick example:

file = discord.File("path/to/my/image.png", filename="image.png")
embed = discord.Embed()
embed.set_image(url="attachment://image.png")
await channel.send(file=file, embed=embed)

Note: Due to a Discord limitation, filenames may not include underscores.

Is there an event for audit log entries being created?

docs: https://discordpy.readthedocs.io/en/latest/faq.html#how-do-i-use-a-local-image-file-for-an-embed-image

Delta
  • 362
  • 1
  • 8
0

You also need to send the file

msg = await ctx.send(embed=e, file=file)
Łukasz Kwieciński
  • 14,992
  • 4
  • 21
  • 39
  • i went to send the file in the embed – cutebear Aug 26 '21 at 17:20
  • I know, have you tried the code? It does exactly what you want – Łukasz Kwieciński Aug 26 '21 at 18:30
  • @cutebear Yes, you can use [await edit()](https://discordpy.readthedocs.io/en/latest/api.html?highlight=edit%20message#discord.Message.edit). – RiveN Aug 26 '21 at 20:00
  • @ŁukaszKwieciński I'm a bit late to the party, but since cutebear didn't elaborate: This does not do what you claim it does. This sends the pic separate from the embed in the same message. That's not the same as having the pic in the embed. – Opifex May 19 '23 at 18:45
  • @Opifex Yes, it does. It sends it as an image *in the embed*. – Łukasz Kwieciński May 19 '23 at 19:36
  • ŁukaszKwieciński No buddy. It doesn't. It sends it as part of the regular message, with the embed part underneath. @Delta's answer is the correct one here. – Opifex May 19 '23 at 20:09
  • What's the difference between his and mine? Apart from tha part where I didn't copy OPs code (cause it's correct, no need to change something that's correct), just added to it. – Łukasz Kwieciński May 19 '23 at 21:43
  • @ŁukaszKwieciński again: yours sends a picture AND an embed. Instead of sending a picture IN an embed. It's a very different outcome. – Opifex Jun 05 '23 at 13:05