Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The code:
- @client.command()
- @commands.has_permissions(ban_members = True)
- async def niceroger2(ctx):
- user_id = 669680584376713259
- user = client.fetch_user(user_id)
- #member = ctx.message.guild.get_member(user_id)
- reason = "Byebye"
- await ctx.channel.send(f"Bye {user}")
- await ctx.guild.ban(user, reason=reason)
- Error paste:
- 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 168, in niceroger2
- await ctx.guild.ban(user, 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: 'coroutine' 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: 'coroutine' object has no attribute 'id'
- Bot Response:
- Bye <coroutine object Client.fetch_user at 0x7f08e00c1bc0>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement