I am creating a bot in discord.py, following a tutorial (here)
My code is working fine until here with commands description that look like this :
`
<code>@bot.command()
async def commands(ctx : commands.Context) -> discord.Message:
</code>
<code>@bot.command()
async def commands(ctx : commands.Context) -> discord.Message:
</code>
@bot.command()
async def commands(ctx : commands.Context) -> discord.Message:
but this time with this part :
<code>bot.command(name="avatar")
async def send_avatar(ctx : commands.Context, user : discord.User = None) -> discord.Message:
print("avatar command")
if user is None :
user = ctx.author
embed = discord.Embed(
title = f"{user.name}'s profile picture",
description=f"[Lien]({user.display_avatar.url})",
color = discord.Color.red()
)
embed.set_image(url =user.display_avatar.url)
return await ctx.send(embed=embed)
</code>
<code>bot.command(name="avatar")
async def send_avatar(ctx : commands.Context, user : discord.User = None) -> discord.Message:
print("avatar command")
if user is None :
user = ctx.author
embed = discord.Embed(
title = f"{user.name}'s profile picture",
description=f"[Lien]({user.display_avatar.url})",
color = discord.Color.red()
)
embed.set_image(url =user.display_avatar.url)
return await ctx.send(embed=embed)
</code>
bot.command(name="avatar")
async def send_avatar(ctx : commands.Context, user : discord.User = None) -> discord.Message:
print("avatar command")
if user is None :
user = ctx.author
embed = discord.Embed(
title = f"{user.name}'s profile picture",
description=f"[Lien]({user.display_avatar.url})",
color = discord.Color.red()
)
embed.set_image(url =user.display_avatar.url)
return await ctx.send(embed=embed)
I raise this error : AttributeError: 'Command' object has no attribute 'Context'
, but on this line excactly and no other one (i have 6 other commands that work fine with the same definition)
And this is the point of commands to have a Context attribute ? Either i’m completely blind on an obvious error, or i’m completely lost.