How would I lock a command behind a specific role?

I want to make a command that only a specific role can run.
10 Replies
d.js toolkit
d.js toolkit•3w ago
- 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!
treble/luna
treble/luna•3w ago
You can only limit it by permission
Stiefanek
Stiefanek•3w ago
How could I do that?
treble/luna
treble/luna•3w ago
Server admins can limit it to roles in the server settings
d.js docs
d.js docs•3w ago
:method: ContextMenuCommandBuilder#setDefaultMemberPermissions() @1.9.0 Sets the default permissions a member should have in order to run this command.
Stiefanek
Stiefanek•3w ago
I mean like, I want to set a command to not be available for anyone, just if you have a specific role. I saw other people doing it like that somehow. I am trying to figure out how.
treble/luna
treble/luna•3w ago
It is yes. But not via discord.js Server admins can adjust it in server settings
Stiefanek
Stiefanek•3w ago
I dont want the whole bot to be a specific role only.
treble/luna
treble/luna•3w ago
or alternatively with the oauth2 token of an admin, but thats not djs related
Server admins can adjust it in server settings
ethan<333
ethan<333•3w ago
server admins can adjust it in their server, meaning command permissions are controlled by the server admins, not the bot developer. you can however set a default permission (e.g. for mod commands so they're restricted before server admins set perms)
Want results from more Discord servers?
Add your server