Search code examples
pythondiscordbotsembed

Stuck to find user avatar for embeds (discord python)


I have this code where I am gone track playtime (no its not finished) But when setting this up i encounterd this problem:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'user_avatar_url'

Here is my code: Ty for reading and helping me :D

#embeds
@client.command()
async def embed(ctx):
    print("embed send") #me trying to debug this
    embed = discord.Embed(title="Test", url="https://google.com", description="I am an idiot", color=0xEB0E0E)
    embed.set_author(name=ctx.author.display_name, url="https://google.com", icon_url=ctx.author.user_avatar_url)
    await ctx.send(embed=embed)

Solution

  • Replace ctx.author.user_avatar_url with ctx.author.avatar_url and it should work as expected.