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
that means nothing
if the role it tries to add is higher than the bots highest role, it wont work
I just moved the role on top of the list, let me try again
it works thank you
also how can I make the bot to send an embed to a specific channel?
and not in the channel the command was runned
I know how to do that, I don't know how to send the embed in different channel from the one the user send it
I use interaction.reply?
not possible with reply
use what i said above
you still have to reply though
above it says how to find or get a channel
it does indeed
it doesn't say how to send the embed to the channel, I have the channel already
or I am dumb and I can't understand it
thank you!