Ethan Armstrong
Ethan Armstrong

Reputation: 83

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!

Upvotes: 4

Views: 2550

Answers (2)

Danish Co-deer
Danish Co-deer

Reputation: 1

I had a similar issue, and moving the bots role up the role hiearchy worked for me.

Upvotes: 0

Supreme1707
Supreme1707

Reputation: 178

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.

Upvotes: 3

Related Questions