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)
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)
Instead of title attribute set author attribute using set_author() method. Like this:
@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)
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.
In this case, the picture is in the embed.thumbnail and in embed.author.image, so you have to set these two:
@client.command()
async def test(ctx):
test = discord.Embed(title=f"Your embed title in the picture you attached it's Eggspert Player but doesn't have to be")
test.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url)
test.set_thumbnail(url=ctx.author.avatar_url)
await ctx.send(embed=test)
References: