nextcord / nextcord

A Python wrapper for the Discord API forked from discord.py
https://docs.nextcord.dev
MIT License
1.17k stars 187 forks source link

Please help, I get a TypeError and can't use it. #179

Closed minomizuha closed 3 years ago

minomizuha commented 3 years ago

Summary

Please help, I get a TypeError and can't use it.

Reproduction Steps

syu = [n for n, v in member.guild_permissions if v is True]
embed.add_field(name="authority", value=syu, inline=False)

I'm getting an error in these two sentences, but this is the first time I'm reporting it, so I don't know what to do, sorry!

Minimal Reproducible Code

@bot.command(aliases=["user"])
async def ui(ctx, user: nextcord.User = None ):
    col = random.randint(0x000000, 0xffffff)
    if user == None:
        user = ctx.author
    member = nextcord.utils.get(bot.get_all_members(), id=user.id)
    syu = [n for n, v in member.guild_permissions if v is True]
    embed.add_field(name="authority", value=syu, inline=False)
    await ctx.reply(embed=embed)

Expected Results

It should show you all the permissions you have.

Actual Results

Ignoring exception in command ui: Traceback (most recent call last): File "C:\paison\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped ret = await coro(*args, **kwargs) File "C:\Users\wa\Desktop\rouxen\rowen.py", line 1265, in ui syu = [n for n, v in member.guild_permissions if v is True] File "C:\Users\wa\Desktop\rouxen\rowen.py", line 1265, in syu = [n for n, v in member.guild_permissions if v is True] File "C:\paison\lib\site-packages\nextcord\flags.py", line 134, in iter yield (name, self._has_flag(value.flag)) File "C:\paison\lib\site-packages\nextcord\flags.py", line 137, in _has_flag return (self.value & o) == o TypeError: unsupported operand type(s) for &: 'int' and 'NoneType'

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

Traceback (most recent call last): File "C:\paison\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke await ctx.command.invoke(ctx) File "C:\paison\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke await injected(*ctx.args, **ctx.kwargs) File "C:\paison\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped raise CommandInvokeError(exc) from exc nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: unsupported operand type(s) for &: 'int' and 'NoneType'

Intents

PRESENCE INTENT,SERVER MEMBERS INTENT

System Information

Checklist

Additional Context

No response

ooliver1 commented 3 years ago

^^ this seems to happen in list comps but not normal for loops

ooliver1 commented 3 years ago

after a bit more, it seems to happen at the very end of a member permissions object

ooliver1 commented 3 years ago

oh actually, @sikkokuhyouma i believe this was fixed in a 2 day old pr, could you update?

ooliver1 commented 3 years ago

image

ooliver1 commented 3 years ago

reopen if still issue

minomizuha commented 3 years ago

I'm sorry, but apparently it was working in Discord.py, but after using this nextcord, it stopped working. I'm sorry for the delay. I'm sorry for the delay. I've been struggling with it since then, but I couldn't fix it.