Discord.ext.Commands.errors.Commandinvokeerror: Command Raised an Exception: Nameerror: name 'ctx' is not defined

Asked

Viewed 39 times

0

I’m trying to make a command that shows the avatar of the person who summoned him inside a embed. So far the code is this:

@client.command()
async def avatar(message, *member : discord.Member):
    author = message.author
    pfp = author.avatar_url
    ctx.send(f'Perfil de {member.name}')
    embed = discord.Embed(color = discord.Colour.red())
    embed.set_image(url = pfp)
    embed.set_footer(text = f'Pedido por {author}')
    await message.reply(embed = embed)

However, when I run the command, the following error appears in the output:

Discord.ext.Commands.errors.Commandinvokeerror: Command Raised an Exception: Nameerror: name 'ctx' is not defined

NOTE: If you know and can, please also try to do so that the command can show the profile photo of other people when you mark them, for example:

g!avatar @alguém

I’ve tried this by making an if/Else by changing the string "pfp" to "Member.author_url" and making the necessary changes, but it still didn’t work.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.