简体   繁体   中英

Python discord bot perms

Im having another issue with my bot. I own the bot and the server, everytime i try to kick or ban i get this error

./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

dose anyone know why?

You didn't give permissions to your bot to kick or ban that's why it is doing that to give permissions go to https://discordapp.com/developers/applications now click on bot you were editing click on OAuth2. under scopes click "bot" now give it the kick/ban permissions. add it in your server using the link given in the scopes now it will work just fine.i had the same problem i fixed it that way if you still can't solve it msg me then.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM