How do I use a local image file to an embed that's a page?
Dynamixus opened this issue · comments
Describe the bug
Uhm this is not exactly a Bug Report but there's no other type here. But I wanted to use a local file to set a thumbnail, but I don't see a functionality to it that's there in a normal embed where you can pass the file = f
to your await.context.send(embed=e)
.
So I'm quite unsure how to get to doing this.
I'm using the code below as normally for my embeds.
Minimal Reproducible Code
f = discord.File("./images/bot_icon.png", filename="icon.png")
embed.set_thumbnail(url="attachment://icon.png")
embed.set_footer(text=f"Requested by {context.author}", icon_url = context.author.avatar.url)
await context.send(file=f, embed=embed)
Traceback
None
Library Version
- Python v3.10.0-final
- discord.py v2.3.1-final
- aiohttp v3.8.4
- system info: Windows 10 10.0.19044
Required Checklist
- I am using discord.py 2.0 or higher
- I am using reactionmenu 3.1.0 or higher
- I have the required intents enabled
Additional Comments
No response
Code
@bot.command()
async def abc(ctx: commands.Context):
menu = ReactionMenu(ctx, menu_type=ReactionMenu.TypeEmbed)
f = discord.File("car.jpeg", filename="car.jpeg")
embed = discord.Embed(title="With local image")
embed.set_thumbnail(url="attachment://car.jpeg")
embed.set_footer(text=f"Requested by {ctx.author}", icon_url = ctx.author.avatar.url)
menu.add_page(embed, files=[f])
menu.add_page(discord.Embed(title="Hello"))
menu.add_buttons([ReactionButton.back(), ReactionButton.next()])
await menu.start()
Produces
![image](https://private-user-images.githubusercontent.com/52070034/250035196-f4e096b4-a024-4401-838c-c0e86b76851c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDgzMzE1MjIsIm5iZiI6MTcwODMzMTIyMiwicGF0aCI6Ii81MjA3MDAzNC8yNTAwMzUxOTYtZjRlMDk2YjQtYTAyNC00NDAxLTgzOGMtYzBlODZiNzY4NTFjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjE5VDA4MjcwMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdiOTFmNGJmOWU2Y2Y0ZjNlNGZkMDU3MWExMzdkODBjOWM2NDA4MmJiNTJjNmU1YWZjZWRjYWFjYmQ1ZTQ1YmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WGSWO7uQ9QeaOVV7RyEUDWg7TnL1Py_Fodkia_9ETBo)
Explanation
Method .add_page()
has a files
parameter.