Loboh67
Loboh67

Reputation: 53

Use local file as set_thumbnail on embed in Discord.py

I want to post an embed with a thumbnail on it, with a local file on my PC. Whenever I try to run this code, the image is sent outside the embed.

embedVar = discord.Embed(title="title",
                        description="desc.",
                         color=0X19A6FF)
file = discord.File("file_location/file.png", filename="image.png")
embedVar.set_thumbnail(url="attachment://file_location/file.png")
await message.channel.send(file=file, embed=embedVar)

Upvotes: 4

Views: 4443

Answers (1)

Łukasz Kwieciński
Łukasz Kwieciński

Reputation: 15689

The filename in the File constructor and the filename in the URL have to match. Currently you're passing the whole path, it's supposed to be only the name

embedVar.set_thumbnail(url="attachment://image.png")

Upvotes: 6

Related Questions