Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

discord.py avatar command bringing up error

I am running an avatar command which worked before, but every time I try to run it now it gives me the error :

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'

I feel I am doing something dumb, but what is going wrong?

Here is the code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True

client = commands.Bot(command_prefix="p!", intents=intents)

@client.command()
async def avatar(ctx, user:discord.Member=None):
    if user is None:
        await ctx.send("Invalid user!")
    await ctx.send(user.avatar_url)

client.run('xxxxx')

Thanks in advance for the help.

>Solution :

If you’ve updated your discord.py then avatar_url got replaced with avatar.url.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading