Conditions
Just like actions, conditions are defined by an id
and a set of args
. Condition is a way to check if a certain condition is met before executing an action or something else.
You can define conditions in script, custom commands, embeds, commands, and more.
- id: hasPermission
args:
value: "MANAGE_MESSAGES" # Permission ID or name
invert: true # Optional
As shown in the example above, all conditions can include an optional invert
argument:
- id: aboveMembers
args:
amount: 100
invert: true # Optional
Setting invert: true
will negate the condition, meaning it will only be true if the original condition is false.
Alternatively you can prefix the condition ID with !
to invert it. For example, !hasPermission
is equivalent to hasPermission
with invert: true
.
Not Met Actions
If a condition is specific to an action (i.e., listed under that action's conditions: []
), you can define not-met-actions
.
These are fallback actions executed when the condition is not met. Here's an example:
actions:
- id: addReaction
args:
value: "✅"
conditions:
- id: hasPermission
args:
value: "MANAGE_MESSAGES"
not-met-actions:
- id: addReaction
args:
value: "❌"
In this example, if the user does not have the MANAGE_MESSAGES
permission, the bot will react with ❌. Otherwise, it will react with ✅.
All Conditions
aboveMembers
Check if the amount of members in a guild is above a certain number.
id: aboveMembers
args:
amount: #number
anyOf
Check if any of the conditions are true.
id: anyOf
args:
conditions: #array of conditions
atLeastOf
Check if at least a certain amount of conditions are true.
id: atLeastOf
args:
amount: #number, the amount of conditions that must be true
conditions: #array of conditions
bellowMembers
Check if the amount of members in a guild is bellow a certain number.
id: bellowMembers
args:
amount: #number
content
Check if a content of an trigger equals a certain text.
id: content
args:
value: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)
contentContains
Check if a content of an trigger contains a certain text.
id: contentContains
args:
value: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)
isExpressionTrue
Check if an expression is true.
This condition have a special format to easily use expressions. You can directly use the expression in the conditions
section without needing to define it in the args
.
id: isExpressionTrue
args:
value: #string, the expression to check
hasPermission
Check if a user has a certain permission.
id: hasPermission
args:
value: #string or array of strings, the permission ID or name
hasRole
Check if a user has a certain role.
id: hasRole
args:
value: #string or array of strings, the role ID or name
inherit: #boolean, if the role should be inherited from the user (optional)
isBot
Check if a user is a bot.
id: isBot
isUser
Check if a user is a certain user
id: isUser
args:
value: #string or array of strings, the user ID
inChannel
Check if a message is in a certain channel or category.
id: inChannel
args:
value: #string or array of strings, the channel ID, category ID or name
inTicket
Check if a message is in a ticket. Requires Tickets plugin.
id: inTicket
regex
Check if a content of an action matches a certain regex.
id: regex
args:
value: #string, the regex pattern to check
startsWith
Check if a content of an action starts with a certain text.
id: startsWith
args:
value: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)