Python 不和谐机器人烫发



我的机器人遇到了另一个问题。我拥有机器人和服务器,每次我尝试踢或禁止时,我都会收到此错误

./discordbot.py 
Bot is online
Ignoring exception in command kick:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/core.py", line 79, in wrapped
ret = await coro(*args, **kwargs)
File "./discordbot.py", line 25, in kick
await member.kick(reason=reason)
File "/usr/local/lib/python3.7/dist-packages/discord/member.py", line 464, in kick
await self.guild.kick(self, reason=reason)
File "/usr/local/lib/python3.7/dist-packages/discord/guild.py", line 1569, in kick
await self._state.http.kick(user.id, self.id, reason=reason)
File "/usr/local/lib/python3.7/dist-packages/discord/http.py", line 218, 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 "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/bot.py", line 863, in invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/core.py", line 728, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/core.py", line 88, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 FORBIDDEN (error code: 50013): Missing Permissions

有人知道为什么吗?

您没有向机器人授予踢或禁止的权限,这就是为什么它这样做以授予权限转到 https://discordapp.com/developers/applications 现在单击您正在编辑的机器人单击OAuth2。 在"范围"下,单击"机器人"现在为其提供踢/禁止权限。 使用范围中给出的链接将其添加到您的服务器中 现在它将正常工作。我遇到了同样的问题,如果您仍然无法修复,我以这种方式修复了它那就解决吧。

最新更新