Advertisement
Guest User

Untitled

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