Задать вопрос
LIREN
@LIREN
Пунктумофоб

'Member' object has no attribute 'avatar_url_as'. Почему?

Не знаю почему не дает аватарку пользователя... Помогите пожалуйста. Вот код:
@commands.command()
    async def profile(self, ctx, member: discord.Member = None):
        if not member:
            member = ctx.author

        await open_account(self, member)
        
        users = await get_bank_data()
        member_amt = users[str(member.id)]["wallet"]

        name, nick, Id, status = str(member), member.display_name, str(member.id), str(member.status).upper()
        created_at = member.created_at.strftime("%a %b\n%B %Y")
        joined_at = member.joined_at.strftime("%a %b\n%B %Y")


        money, level = f"{member_amt}", "Скоро..."

        base = Image.open(
            "base.png"
        ).convert("RGBA")
        background = Image.open(
            "bg.png"
        ).convert("RGBA")

        pfp = member.avatar_url_as(size = 256)
        data = io.BytesIO(await pfp.read())
        pfp = Image.open(data).convert("RGBA")

        name = f"{name[:16]}" if len(name) > 16 else name
        nick = f"AKA - {nick[:17]}.." if len(nick) > 17 else f"AKA - {nick}"

        draw = ImageDraw.Draw(base)
        pfp = circle(pfp, (215, 215))
        font = ImageFont.truetype("Nunito-Regular.ttf", 38)
        akafont = ImageFont.truetype("Nunito-Regular.ttf", 30)
        subfont = ImageFont.truetype("Nunito-Regular.ttf", 25)

        draw.text((280, 240), name, font = font)
        draw.text((270, 315), nick, font = akafont)
        draw.text((65, 490), Id, font = subfont)
        draw.text((405, 490), status, font = subfont)
        draw.text((65, 635), money, font = subfont)
        draw.text((405, 635), level, font = subfont)
        draw.text((65, 770), created_at, font = subfont)
        draw.text((405, 770), joined_at, font = subfont)
        base.paste(pfp, (56, 158), pfp)

        background.paste(base, (0, 0), base)

        with io.BytesIO() as a:
            background.save(a, "PNG")
            a.seek(0)
            await ctx.send(file = discord.File(a, "profile.png"))

Терминал:
Ignoring exception in command profile:
Traceback (most recent call last):
  File "C:\Users\egorl\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 179, in wrapped
    ret = await coro(*args, **kwargs)
  File "D:\botjs\pycommands\profile.py", line 95, in profile
    pfp = member.avatar_url_as(size = 256)
AttributeError: 'Member' object has no attribute 'avatar_url_as'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\egorl\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 335, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\egorl\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 916, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\egorl\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 188, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url_as'
  • Вопрос задан
  • 374 просмотра
Подписаться 1 Простой 1 комментарий
Решения вопроса 1
SoreMix
@SoreMix Куратор тега Python
yellow
upd: pip uninstall py-cord
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы