由于“权限”导致“禁止/踢入Discord.py”错误

时间:2020-05-11 20:12:13

标签: python python-3.x discord.py

我正在创建一个机器人,如果用户不遵守规则,该机器人可以禁止和踢用户。 当我执行!ban @user时出现错误

Ignoring exception in command kick:
Traceback (most recent call last):
  File "C:\Users\Daniel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 83, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:/Users/Daniel/Desktop/DAN/1/8/0/1/PROGRAMMING/LegacyCoding/DiscordVidTutBot/bot.py", line 85, in kick
    await ctx.guild.kick(member, reason=reason)
  File "C:\Users\Daniel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\guild.py", line 1627, in kick
    await self._state.http.kick(user.id, self.id, reason=reason)
  File "C:\Users\Daniel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\http.py", line 221, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
  File "C:\Users\Daniel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\bot.py", line 892, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Daniel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 797, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Daniel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 92, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

我已经遍历了discord的开发人员部分,并确保它具有执行禁止和踢脚命令所需的所有权限,例如admin kick members ban members,但仍然无法正常工作。有谁知道这个的原因以及我该如何解决?

1 个答案:

答案 0 :(得分:2)

我找到了一个解决方法,结果发现我试图以比机器人更高的权限踢一个成员,所以它不会踢他们。