Restricting Access to a Command
What options are there?
There's a few different options for restricting who can use a command.
Option | Difficulty | Hides Command | Automatic Multi-Server | Restrict By | Works With | Update Rules Dynamically |
---|---|---|---|---|---|---|
Integrations Tab | 1/5 | ✅ (hidden if role/member/channel requirements not met) | ❌ (configure on every server) | Member, Role, Channel | Slash Command, Context Menu | ❌ |
If Statement | 3/5 | ❌ (anyone can see the command; error if restricted) | ✅ | Member, Role, Channel, Permission, Custom | Any flow | ✅ |
Inventor Permission Config | 1/5 | ✅ (hidden if permissions inadequate) | ✅ | Permission | Slash Command | ❌ |
We recommend picking the Integrations Tab unless you're building a public bot that anyone can add, in which case you'll want to use Inventor Permission Config or If Statements depending on your use case.
Integrations Tab
The integrations tab is easy to configure. Simply make (and sync/refresh to be able to see) your command, then go to Server Settings > Integrations and click your bot.
Now select whichever command or context menu you would like to restrict access to and customize which users/roles/channels it can and can't be used in.
You can also restrict permissions for your entire bot using the menu at the top.
If Statement
Restrict based on Role
At the top of the flow you'd like to restrict permissions on, add a Get Server Member block. Fill it in with the Server ID and Executing User ID (for most flows; use User ID if Executing User ID is not present) outputs from the trigger.
Now add an If Statement with the condition of “Get Server Member - Role IDs" "does not contain” and the role ID that is allowed to use the flow.
Custom Restrictions
- Permission based
- This one's a bit tricker! You need to iterate over each of the member's roles and check if that role has the needed permission. As it's more complex, we're unable to provide custom instructions.
- Database-based
- Use Get Row by Values. If Row Found = false, Exit Flow.
- Other Restrictions
- Simply use Inventor's vast collection of blocks and check if a specific condition isn't met. If it isn't, then exit the flow!
- Combining Restrictions
- You can use an Advanced Conditional rather than an If Statement to make the call on whether or not the user is able to use the command.
Inventor Permission Config
Inventor has a built-in way to require a specific permission for a slash command. It even hides the command if the permission isn't met! To configure it, just select the Slash Command trigger at the top of the flow and select the required permissions from the dropdown.