Moderation
blacklistRolesIDs
$blacklistRolesIDs
The guard function $blacklistRolesIDs blocks the execution of the command if the user has any of the blacklisted roles, identified by their ID. It is the ID variant of $blacklistRoles, which compares role names.
Syntax
$blacklistRolesIDs[roleID1;roleID2;...;errorMessage]
Parameters
| Parameter | Type | Description |
|---|---|---|
roleID1;roleID2;... |
Snowflake[] | IDs of blacklisted roles. At least one value is required (empty values are ignored). |
errorMessage |
String | Required, always the last argument. Message returned when the guard stops the command; it replaces the output of the script. Leave it empty (; at the end) for a silent stop. |
The function therefore needs at least 2 arguments. With a single argument, the call is rejected (“Invalid argument count”).
Behavior
- Looks up the roles of the command author (
author.id, oruser.id) in the current server and compares the values with the ID of each of those roles (each value must be a valid Discord ID, otherwise an error “Invalid Discord ID.” is raised). The@everyonerole (whose ID is the server ID) counts as a role of the user. - The match is an OR: a single matching role is enough.
- If the user has at least one matching role, the script is stopped and the error message is used as output.
- If the user has none (or all values are empty), the command continues.
Return Value
Returns an empty string when the command continues. When the guard stops the command, the script is stopped and the error message (last argument) is used as its output.
Examples
Muted Role
$blacklistRolesIDs[123456789012345678;❌ You are muted.]
$sendMessage[Processing completed.]
Multi-roles
$blacklistRolesIDs[111111111111111111;222222222222222222;333333333333333333;❌ Access denied.]
$sendMessage[OK.]
Silent stop
$blacklistRolesIDs[123456789012345678;]
$sendMessage[OK.]
Notes
$blacklistRolesIDscompares role IDs;$blacklistRolescompares role names.- To whitelist roles by ID, use
$onlyForRoleIDs.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.