Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Permissions Error For Granting a Role

I'm having an issue when trying to grant roles to server admins. For regular permissions it works fine, but if it's a server admin role, or some other role with permissions, even if I'm the owner, it gives the following error:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions 

And the code I'm using is:

@client.command()
@commands.has_permissions(manage_messages = True)
async def grant(ctx , user : discord.Member , role : discord.Role):
  await user.add_roles(role)
  await ctx.send(f"Our Comrade {user.name} has received the {role.name} role!")

Any help would be appreciated!

like image 537
Ethan Armstrong Avatar asked Oct 16 '25 23:10

Ethan Armstrong


1 Answers

403 Forbidden (error code: 50013): Missing Permissions shows up not because you don't have permissions but rather because the bot doesn't have permissions. Try moving the bot's top role up the role hierarchy and give it all the required permissions. In this case, it needs to be above the admin role and have the Manage Roles permission.

like image 51
Supreme1707 Avatar answered Oct 19 '25 13:10

Supreme1707