Kaizen86 / Python-Discord-Bot

A Discord bot I made in Python
0 stars 0 forks source link

Inexplicable missing permissions error #16

Closed Kaizen86 closed 3 years ago

Kaizen86 commented 3 years ago

Occurred when a normal user requested a new colour role. This error indicates a fault in the code responsible for moving new roles to the highest possible location.

Full error log:

10/29 04:21:00 [Error handler] Traceback (most recent call last):
  File "/home/daniel/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/daniel/DiscordBots/Python-Discord-Bot/cogs/role-manager.py", line 167, in colour
    await ctx.guild.edit_role_positions(positions={role: position})
  File "/home/daniel/.local/lib/python3.9/site-packages/discord/guild.py", line 1964, in edit_role_positions
    data = await self._state.http.move_role_position(self.id, role_positions, reason=reason)
  File "/home/daniel/.local/lib/python3.9/site-packages/discord/http.py", line 254, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
  File "/home/daniel/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/daniel/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/daniel/.local/lib/python3.9/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: HTTPException: 400 Bad Request (error code: 50013): Missing Permissions
Kaizen86 commented 3 years ago

Unable to reproduce error - will add try/catch to silently fail as this probably isn't a real issue