Error 50013 thrown when giving and removing roles
Heyy so I'm getting started with discord.js and created a command that should give and remove a role depending on whether a user has it via interactions. I think I understand how roles work in discord, but I'm confused as to why I'm getting a permission error. Hopefully someone can help!
17 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
Gateway intent bits:
Error is thrown right after line 12 (
await interaction.member.roles.remove(roleID);
) runs which leads me to think that it is a role-management permission problemdoes your bot have permissions to manage roles
and is the bot's highest role above that role?
When I added it to the test server, I set its permission code as 8 which I thought just made it an admin. I'll send its explicit perms rq
administrator does not mean it can add any role
its still limited to the hierarchy
Ah oof
it can add roles that are below its highest role
any roles above that, or managed roles, will throw a missing perms error
I see. Will enabling every permission allow it to give any role?
no
The role it is trying to give is simply a color role with no perms attatched btw
administrator is all perms
Ah ok
but in order to give the role, the bot's role needs to be higher
by default, new roles, and i assume this includes the bot role, are placed at the bottom
you also cannot moderate members that have a higher role
You were right! Adjusting that order fixed it completely
I had no idea that the order in which roles are stacked mattered lol
Thank you!
yw!