This page is generated from
docs/cog_permissions.rst- please edit the source file instead of this page.
Permissions Cog Reference
How it works
When loaded, the permissions cog will allow you to define extra custom rules for who can use a command.
If no applicable rules are found, the command will behave normally.
Rules can also be added to cogs, which will affect all commands from that cog. The cog name can be found from the help menu.
Rule priority
Rules set for subcommands will take precedence over rules set for the parent commands, which
lastly take precedence over rules set for the cog. So for example, if a user is denied the Core
cog, but allowed the [p]set token command, the user will not be able to use any command in the
Core cog except for [p]set token.
In terms of scope, global rules will be checked first, then server rules.
For each of those, the first rule pertaining to one of the following models will be used:
- User
- Voice/stage channel a user is connected to
- The channel command was issued in (parent channel in case of invocations in threads)
- Channel category
- Roles, highest to lowest
- Server (can only be in global rules)
- Default rules
In private messages, only global rules about a user will be checked.
Setting Rules From a File
The permissions cog can also set, display or update rules with a YAML file with the
[p]permissions yaml command. Models must be represented by ID. Rules must be true for
allow, or false for deny. Here is an example:
COG:
Admin:
78631113035100160: true
96733288462286848: false
Audio:
133049272517001216: true
default: false
COMMAND:
cleanup bot:
78631113035100160: true
default: false
ping:
96733288462286848: false
default: true
Example configurations
Locking the [p]play command to approved server(s) as a bot owner:
[p]permissions setdefaultglobalrule deny play
[p]permissions addglobalrule allow play [server ID or name]
Locking the [p]play command to specific voice channel(s) as a serverowner or admin:
[p]permissions setdefaultserverrule deny play
[p]permissions setdefaultserverrule deny "playlist start"
[p]permissions addserverrule allow play [voice channel ID or name]
[p]permissions addserverrule allow "playlist start" [voice channel ID or name]
Allowing extra roles to use [p]cleanup:
[p]permissions addserverrule allow cleanup [role ID]
Preventing [p]cleanup from being used in channels where message history is important:
[p]permissions addserverrule deny cleanup [channel ID or mention]
Installation Guides
- Installing Red
- Creating a bot account
- Updating Red
- Backing Up and Restoring Red
- About Virtual Environments
- Setting up auto-restart using batch on Windows
- Setting up auto-restart on Mac
- Setting up auto-restart using systemd on Linux
Cog Reference
User guides
- Getting started
- Running Red on Fluxer
- About Privileged Intents
- About public (big) bots
- Admin
- Alias
- Audio
- Cleanup
- Cog Manager UI
- Core
- CustomCommands
- Dev
- Downloader
- Economy
- Filter
- General
- Image
- Permissions
- Mod
- ModLog
- Mutes
- Reports
- Streams
- Trivia
- Warnings
- Red and End User Data
Cog Creation Guides
- Creating cogs for Red
- Slash Commands and Interactions
- Publishing cogs for Red
- Becoming an Approved Cog Creator
- Versioning
- End-user Guarantees
- Developer Guarantees
- Breaking Change Notices
Cog Development Framework Reference
- Shared API Keys
- Bank
- Bot
- Command Check Decorators
- App Command Check Decorators
- Commands Package
- App Commands Package
- Config
- Data Manager
- Custom Events
- Internationalization Framework
- Mod log
- RPC
- Tree
- Utility Functions
Others
Legacy (Red V2)