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, message components, commands, and more.
- id: hasPermission
args:
value: "MANAGE_MESSAGES" # Permission ID or name
inverse: true # Optional
As shown in the example above, all conditions can include an optional inverse argument:
- id: memberCountAbove
args:
amount: 100
inverse: true # Optional
Setting inverse: 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 inverse: 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
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
coinsAbove
Check if a user has more than a certain amount of coins.
id: coinsAbove
args:
amount: #number, the amount of coins to check
coinsBelow
Check if a user has less than a certain amount of coins.
id: coinsBelow
args:
amount: #number, the amount of coins 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)
hasTag
Check if a post has a certain tag.
id: hasTag
args:
value: #string or array of strings, the tag 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
isBooster
Check if a user is a server booster.
id: isBooster
isBot
Check if a user is a bot.
id: isBot
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
isOnCooldown
Check if a user is on cooldown for a certain action.
id: isOnCooldown
args:
value: #string, the action ID to check cooldown for
isReply
Check if a message is a reply to another message.
id: isReply
isUser
Check if a user is a certain user
id: isUser
args:
value: #string or array of strings, the user ID
matchesRegex
Check if the content of an action matches a certain regex pattern.
id: matchesRegex
args:
value: #string, the regex pattern to check
memberCountAbove
Check if the amount of members in a guild is above a certain number.
id: memberCountAbove
args:
amount: #number
memberCountBelow
Check if the amount of members in a guild is below a certain number.
id: memberCountBelow
args:
amount: #number
metaAbove
Check if a meta value is above a certain number. Only works with number type.
id: metaAbove
args:
key: #string, the meta key to check
value: #number, the value to check against
metaBelow
Check if a meta value is below a certain number. Only works with number type.
id: metaBelow
args:
key: #string, the meta key to check
value: #number, the value to check against
metaEquals
Check if a meta value equals a certain value. Only works with number, string, boolean type.
id: metaEquals
args:
key: #string, the meta key to check
value: #string, the value to check against
metaIncludes
Check if a meta value includes a certain value. Only works with list type.
id: metaIncludes
args:
key: #string, the meta key to check
value: #string, the value to check against
textContains
Check if the text is contains certain text.
id: textContains
args:
input: #string, the text to check
output: #string or array of strings, the text to check against
ignore-case: #boolean, if the check should be case-insensitive (optional)
textEndsWith
Check if the text ends with a certain text.
id: textEndsWith
args:
input: #string, the text to check
output: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)
textEquals
Check if the text equals a certain text.
id: textEquals
args:
input: #string, the text to check
output: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)
textLengthAbove
Check if the text is above a certain length.
id: textLengthAbove
args:
text: #string, the text to check
amount: #number, the length to check
textLengthBelow
Check if the text is below a certain length.
id: textLengthBelow
args:
text: #string, the text to check
amount: #number, the length to check
textStartsWith
Check if the text starts with a certain text.
id: textStartsWith
args:
input: #string, the text to check
output: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)