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
invert: true # Optional
As shown in the example above, all conditions can include an optional invert
argument:
- id: memberCountAbove
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
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
contentContains
Check if the content of a trigger contains 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)
contentEndsWith
Check if the content of a trigger ends with certain text.
id: contentEndsWith
args:
value: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)
contentEquals
Check if the content of a trigger equals a certain text.
id: contentEquals
args:
value: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)
contentLengthAbove
Check if the content of a trigger is above a certain length.
id: contentLengthAbove
args:
amount: #number, the length to check
contentLengthBelow
Check if the content of a trigger is below a certain length.
id: contentLengthBelow
args:
amount: #number, the length to check
contentStartsWith
Check if a content of an action starts with a certain text.
id: contentStartsWith
args:
value: #string or array of strings, the text to check
ignore-case: #boolean, if the check should be case-insensitive (optional)
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)
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