you cant just use avamember simply as parameter, you need to define avamember using avamember:discord.Member
. Perhaps you're trying to create an avatar command, this will work
@bot.command()
async def avatar(ctx, *, avamember: discord.Member = None):
if avamember == None:
embed = discord.Embed(description='❌ Error! Please specify a user',
color=discord.Color.red())
await ctx.reply(embed=embed, mention_author=False)
else:
userAvatarUrl = avamember.avatar_url
embed = discord.Embed(title=('{}\'s Avatar'.format(avamember.name)), colour=discord.Colour.red())
embed.set_image(url='{}'.format(userAvatarUrl))
await ctx.reply(embed=embed, mention_author=False)
If you're using Cogs then use this one
@commands.command()
async def avatar(self, ctx, *, avamember: discord.Member = None):
if avamember == None:
embed = discord.Embed(description='❌ Error! Please specify a user',
color=discord.Color.red())
await ctx.reply(embed=embed, mention_author=False)
else:
userAvatarUrl = avamember.avatar_url
embed = discord.Embed(title=('{}\'s Avatar'.format(avamember.name)), colour=discord.Colour.red())
embed.set_image(url='{}'.format(userAvatarUrl))
await ctx.reply(embed=embed, mention_author=False)