#help

1 messages · Page 1 of 1 (latest)

atomic crystal
#

error
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\commands\core.py", line 173, in wrapped
ret = await coro(args, **kwargs)
File "C:\Users\User\OneDriveРабочий столпрограммирование\MindaBot\cogs\uliti.py", line 74, in user
embed.add_field(name="Статус:", value=inter.message.member.activity,inline=True)
AttributeError: 'Message' object has no attribute 'member'

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

Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\commands\bot_base.py", line 591, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\commands\core.py", line 914, in invoke
await injected(ctx.args, **ctx.kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\commands\core.py", line 182, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Message' object has no attribute 'member'

#
    @commands.command()
    async def user(self, inter, member: disnake.Member = None):
        if member is None:
            member = inter.author
        t = member.status
        if t == disnake.Status.online:
            d = ":3932online: В сети"

        t = member.status
        if t == disnake.Status.offline:
            d = " :3932offline: Не в сети"

        t = member.status
        if t == disnake.Status.idle:
            d = " :7693idle: Неактивен"

        t = member.status
        if t == disnake.Status.dnd:
            d = ":8890dnd: *Не беспокоить*"
        roles = [role for role in member.roles]
        embed = disnake.Embed(title=f"Информация о  {member.name}")
        embed.set_thumbnail(url=member.avatar.url if member.avatar is not None else member.default_avatar)
        embed.add_field(name="ID", value=member.id, inline=True)
        embed.add_field(name="Никнейм", value=f"{member.display_name}", inline=True)
        embed.add_field(name="Активность:", value=d,inline=True)
        embed.add_field(name="Статус:", value=inter.message.member.activity,inline=True)
        for a in member.activities:
            if a.type == disnake.ActivityType.playing: 
                embed.add_field(name="Играет в:",value=a.name)
        for i in member.activities:
            if i.type == disnake.ActivityType.streaming: 
#
                embed.add_field(name="Стримит:",value=a.name)
        #embed.add_field(name = "Слушает Spotify", value= name.album, inline= True)
        embed.add_field(name="Аккаунт создан", value=f'{disnake.utils.format_dt(member.created_at, "f")} ({disnake.utils.format_dt(member.created_at, "R")})', inline=True)
        embed.add_field(name="Присоеденился на сервер", value=f'{disnake.utils.format_dt(member.joined_at, "f")} ({disnake.utils.format_dt(member.joined_at, "R")})', inline=True)
        embed.add_field(name="Самая высокая роль", value=member.top_role.mention, inline=True)
        await inter.send(embed=embed)```
brisk crow
#

Py.doc disnake disnake.Message

brisk crow
#

Go read the docs

#

You'll find it's author, not member for messages

atomic crystal
#

If I use the author, then if other participants use this comand on other people, then the command will show the author

atomic crystal
quiet magnet
#

It's still not message.member

brisk crow
#

So use the argument you pass to your method for member

#

Instead of trying to get it from the message

atomic crystal
atomic crystal
#

@quiet magnet ?