【发布时间】:2020-05-12 18:23:47
【问题描述】:
我正在创建一个机器人,如果用户不遵守规则,它可以禁止和踢出用户。
当我执行!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
我已经通过了不和谐的开发者部分,并确保它具有执行禁止和踢命令所需的所有权限,例如adminkick membersban members,但仍然无法正常工作。有谁知道这个问题的原因以及我该如何解决?
【问题讨论】:
-
-
错误表明您没有正确的权限。我从未使用过它,但首先我会在出现问题的行之前检查
ctx.guild.me.guild_permissions.kick_members。我还会使用print(member, reason)来检查其他变量中的值。您还应该添加我们可以运行的最少工作代码,看看我们是否也会遇到同样的问题。如果没有代码,您的问题似乎毫无用处,甚至可能没有人会尝试解决它。 -
@furas 没关系,我修好了。
标签: python python-3.x discord.py