Every command here needs Administrator.
How a rule is decided
When someone runs a command, Bloom checks the rules in this order:1
Protected commands always run
A short list of commands can never be blocked, so a bad rule cannot lock you out of fixing it.
2
Administrators always pass
Policies never apply to administrators or the server owner. Test your rules with an ordinary account.
3
The most specific rule wins
Bloom scores every rule that matches and applies the narrowest one.
4
A tie goes to deny
When two equally specific rules disagree, the denial wins.
A channel rule always beats a server rule, whatever else the two rules say. Within the same place, a rule naming one command beats a rule naming a category of commands, which beats a rule naming everything. A rule for a role beats a rule for everyone.
This means the usual pattern works the way you would hope: deny everything server wide, then allow what you want in the channels where you want it.
Commands that cannot be blocked
commandpolicy, disablecommand, enablecommand, restrictcommand, unrestrictcommand, their short aliases, plus setprefix and help.
Setting rules
Administrator
Blocks something. Aliases:
cmdpolicy, cmdrules.- Without a channel the rule covers the whole server.
- Without a role the rule covers everyone.
!commandpolicy deny all #generalturns every command off in one channel.!commandpolicy deny category:funturns off a whole category server wide.
Administrator
Permits something, overriding a broader denial.
!commandpolicy allow ping #generalre-enables one command in a channel you had closed off.
Administrator
Limits something to one or more roles in a single step. Bloom writes a denial for everyone and an allowance for each role you name, replacing any existing rules for that target.
- At least one role is required.
!commandpolicy restrict category:music @DJ #musicleaves music commands working only for DJs, only in that channel.
Checking and undoing rules
Administrator
Lists your rules, each with an ID. With a channel it shows only the rules that affect that channel. Alias:
list.Administrator
Reports how many rules affect a channel, as a quick check before you add another.
Administrator
Answers whether a command would run, for the channel and roles you name, and shows which rule decided it. Use it instead of guessing.
!commandpolicy test ping #generalexplains the outcome for that combination.
Administrator
Removes rules. Aliases:
remove, delete. Takes a single rule ID from commandpolicy rules, or clears everything at one scope.Administrator
Lists every command category with how many commands it holds, which is how you find the right name for
category:.Shorter commands for common cases
These are shortcuts into the same system. A rule made withdisablecommand is an ordinary policy rule, and shows up in commandpolicy rules like any other.
Administrator
Turns a command off, in one channel or across the server. Aliases:
dcmd, disablecmd.Administrator
Limits a command to a role. Aliases:
restrictcmd, rcmd.Worked example
To make a bot channel the only place general commands work, while leaving moderators unrestricted everywhere:Lock commands to one channel
#bot-commands because a channel rule outranks a server rule. The third beats it for moderators because a role rule outranks an everyone rule at the same scope. Confirm it with !commandpolicy test ping #general before you walk away.
Troubleshooting
My rule does nothing for me but works for others
My rule does nothing for me but works for others
Administrators and the server owner bypass every policy. Test with an account that holds no administrator permission.
A command is still blocked after I allowed it
A command is still blocked after I allowed it
A more specific rule is winning. Run
!commandpolicy test <command> #channel to see which rule decided the outcome, then narrow your allow rule to match or remove the rule that is beating it.Two rules contradict each other
Two rules contradict each other
When two rules are equally specific, the denial wins. Make the allowing rule more specific, for example by naming the channel or the role rather than the whole server.
Cannot disable that command
Cannot disable that command
It is on the protected list, which exists so a rule cannot lock you out of the commands that fix rules.
Command was not found
Command was not found
Use the exact command name rather than an alias, and
!commandpolicy catalog for the category names that category: accepts.I locked myself out of a channel
I locked myself out of a channel
The policy commands still work everywhere. Run
!commandpolicy reset #channel in the affected channel, or !commandpolicy reset server to clear the server wide rules.Related pages
Fake permissions
Granting access to commands rather than taking it away.
Permissions and hierarchy
The permission checks that run after a policy allows a command.
Commands not responding
Working out whether a policy is why nothing happened.
Command aliases
Custom names for commands, which policies apply to as well.