Here is my code example.
@client.command()
async def test(ctx):
test = discord.Embed(
title=f"{ctx.author.avatar_url}",
#skip
)
await ctx.send(embed=test)
In Discord.py 2.0 discord.Member.avatar_url
has been changed to discord.Member.avatar.url
. So the solutions won't work without this small change.
So, (editing loloTester's code):
@client.command()
async def test(ctx):
test = discord.Embed()
test.set_author(name="title", icon_url=ctx.author.avatar.url)
await ctx.send(embed=test)
Also, note that avatar
is only set when the user has set a custom avatar.
If you want to have a url to the avatar, regardless of whenever it's custom or not, use display_avatar
.