Hyperba
Hyperba

Reputation: 119

How can I set an image or thumbnail as the bot's avatar in discord.py embed?

Is it possible to set the embed image as the bot's profile picture?

If user's:

embed=discord.Embed(title="This is my profile pick")
embed.set_author(name="name", icon_url=ctx.author.avatar.url)

so if I wanted to set thumbnail or image as bot's avatar, what would would I do?

I tried:

embed.set_author(name=bot.name, icon_url=bot.avatar.url)

but it does not work. How can I this?

Upvotes: 0

Views: 4425

Answers (3)

Eren
Eren

Reputation: 1

There're 2 ways, first you could just do it manually like embed.set_image(url='bot avatar url') but i really dont recommend this way since its not dynamic and it won't work if you ever change the avatar of bot in future so, try this code this will work

@bot.command()
async def botavatar(ctx):
    BotAvatar = bot.user.avatar_url
    embed = discord.Embed(
        title=f'{bot.user.name}\'s Avatar:',
        color=discord.Colour.red())
    embed.set_image(url=f'{BotAvatar}')
    await ctx.send(embed=embed)

Upvotes: 0

3nws
3nws

Reputation: 1439

You need to access the user attribute on your bot first.

embed.set_author(name="name", icon_url=bot.user.avatar.url)

Or

embed.set_author(name="name", icon_url=bot.user.avatar_url)

Depending on your discord.py version.

Upvotes: 2

LucasPlusPlus
LucasPlusPlus

Reputation: 46

enter image description here

^ ^ ^ After add thumbnail for thumbnail add this embed.set_thumbnail(url=ctx.author.avatar_url)

Upvotes: 0

Related Questions