If statement as stated in FAQ failing?
I have the following code, to attempt to restrict a command to only myself, as the wiki states here. What am I doing wrong? Took me a while to figure out how to build everything else but the command is deploying and running, but always running through to the else statement and posting "This command is only for the developer!"
3 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!
- ✅
Marked as resolved by staffA quick way to make the response ethereal would be nice, too, but wouldn't solve my issue.
exact version 14.14.1, no error, I believe I explained the issue and code is above
Not sure if this is exactly related to discord.js but if the wiki is incorrect it probably belongs here
this is the correct place for this, yes
the if statement on its own looks correct, and there aren't really that many moving parts going into it
I can see that that id is your id, so the only thing off the top of my head that could cause
interaction.user.id
to be the wrong id without erroring would be if you had mismatched params, such as if the first param is supposed to be your Client
this would result in you actually accessing your bot's id rather than the user who used the command
it's also possible that somewhere in your code you accidentally modified the value of the given User
object's id
, but I'm hoping this is unlikely