Reputation: 126
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:
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.
Upvotes: 1
Views: 315
Reputation: 1362
If you've updated your discord.py then avatar_url
got replaced with avatar.url
.
Upvotes: 2