Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2021
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. Code:
  2. @client.command()
  3. @commands.has_permissions(ban_members = True)
  4. async def niceroger(ctx):
  5. id:discord.User=669680584376713259
  6. username = client.get_user(id)
  7. #username = client.get_user(id)
  8. reason = "Bye bye"
  9. await ctx.guild.ban(username, reason=reason)
  10.  
  11. await ctx.channel.send(f"Bye <@669680584376713259>")
  12.  
  13.  
  14. error notes:
  15. Traceback (most recent call last):
  16. File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
  17. ret = await coro(*args, **kwargs)
  18. File "main.py", line 157, in niceroger
  19. await ctx.guild.ban(username, reason=reason)
  20. File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/guild.py", line 2026, in ban
  21. await self._state.http.ban(user.id, self.id, delete_message_days, reason=reason)
  22. AttributeError: 'NoneType' object has no attribute 'id'
  23.  
  24. The above exception was the direct cause of the following exception:
  25.  
  26. Traceback (most recent call last):
  27. File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
  28. await ctx.command.invoke(ctx)
  29. File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
  30. await injected(*ctx.args, **ctx.kwargs)
  31. File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
  32. raise CommandInvokeError(exc) from exc
  33. discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement