Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code:
- @client.command()
- @commands.has_permissions(ban_members = True)
- async def niceroger(ctx):
- id:discord.User=669680584376713259
- username = client.get_user(id)
- #username = client.get_user(id)
- reason = "Bye bye"
- await ctx.guild.ban(username, reason=reason)
- await ctx.channel.send(f"Bye <@669680584376713259>")
- error notes:
- Traceback (most recent call last):
- File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
- ret = await coro(*args, **kwargs)
- File "main.py", line 157, in niceroger
- await ctx.guild.ban(username, reason=reason)
- File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/guild.py", line 2026, in ban
- await self._state.http.ban(user.id, self.id, delete_message_days, reason=reason)
- AttributeError: 'NoneType' object has no attribute 'id'
- The above exception was the direct cause of the following exception:
- Traceback (most recent call last):
- File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
- await ctx.command.invoke(ctx)
- File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
- await injected(*ctx.args, **ctx.kwargs)
- File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
- raise CommandInvokeError(exc) from exc
- discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement