Hide Slash/Context menu commands
I have a number of Slash and Context Menu commands that I would like to hide, unless the user holds certain permissions.
These permissions, I want to define by role (e.g, the 'Moderator' role).
The commands should only be visible for users who have that specific role.
I know that the commands can be maintained on a per guild status, in my instance, the bot only exists and only ever will exist in the context of a single guild - and the list of role IDs that need access are limited.
I know that changing the commands through the Integration tab in Discord - it is possible to effectively hide the commands from those who should not have access.
How can I do this at a code level, and by using a role?
Solution:Jump to solution
You cannot. Through code you can only set it based on a permission level, not a role level. Discord API rules.
The solution here is to set it to administrator in code then change it manually in the UI...
5 Replies
Solution
You cannot. Through code you can only set it based on a permission level, not a role level. Discord API rules.
The solution here is to set it to administrator in code then change it manually in the UI
It's workable, but I wonder if the re-registration of the command when it's re-deployed will knock it back out.
It won't
Also as a rule of thumb: https://tryitands.ee
thanks 😉