I would like to send an embed with a picture, originating from a sqlite3 database. I am correctly fetching the file but it won't display it in the embed.
def init_embed(title, description, colour, picture):
# Create a discord.File object from the image data
file = discord.File(BytesIO(picture), filename='picture.png')
# Name and description
embed = discord.Embed(title=title,
description=description,
colour=colour)
embed.set_image(url="attachment://oc_picture.png") # Set the image using the discord.File object
return embed
The embed is sent properly, the image is just not there for some reason.
According to the documentation, you simply need to send in context the embed and the file in question with:
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)
This works like a charm!