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
d.js toolkit
d.js toolkit15mo ago
• 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.
d.js docs
d.js docs15mo ago
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?
Dãrķ Søŭł
Dãrķ Søŭł15mo ago
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
Dãrķ Søŭł
Dãrķ Søŭł15mo ago
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
d.js docs
d.js docs15mo ago
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
Dãrķ Søŭł
Dãrķ Søŭł15mo ago
SourceBin
Error
Instantly share your code with the world.
Dãrķ Søŭł
Dãrķ Søŭł15mo ago
The error in terminal
Dãrķ Søŭł
Dãrķ Søŭł15mo ago
SourceBin
Demote Command
Instantly share your code with the world.
Dãrķ Søŭł
Dãrķ Søŭł15mo ago
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?
treble/luna
treble/luna15mo ago
you dont have permissions to add or remove the role
Dãrķ Søŭł
Dãrķ Søŭł15mo ago
I do I have administrator
Vigintillion
Vigintillion15mo ago
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
Dãrķ Søŭł
Dãrķ Søŭł15mo ago
it has administrator as well
Vigintillion
Vigintillion15mo ago
Make sure to check that the bot’s role is above the roles you’re adding
Want results from more Discord servers?
Add your server