Demote Command doesn't work.
So I have a demote slash command and when someone runs the command I want to check if they actually have the role to run the command so if they dont have it denies it. But for one reason the if statement doesn't work
25 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.To help you we need more information:
- What are you trying to do?
- What is your code?
- What errors and debug logs do you have?
I am trying to make a demote command for my staff manager bot. I will provide the command as file. I will explain the error after I send the command file
so basically when I try to debug it and I remove the staff manager role from me so I can get denied it works just fine, but when I put back my role to try again to see that the bot will actually demote the person it doesn't work
The error in terminal
the command code
so why the if works when I dont have the role and it continues with the else statement but when I have the role the if statement doesn't work?
you dont have permissions to add or remove the role
I do
I have administrator
Add a try catch to it or a .catch() to check if missing permissions or add an if statement at the start to check for permission
The bot doesnt have permission
it has administrator as well
Make sure to check that the bot’s role is above the roles you’re adding