Conditions
Learn about all the conditions you can use in ItsMyBot to create dynamic and interactive scripts, commands, and components.
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, and more.
- id: hasPermission
args:
value: "MANAGE_MESSAGES" # Permission ID or nameAs shown in the example below, all conditions can include an optional inverse argument:
- id: memberCountAbove
args:
amount: 100
inverse: trueSetting 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.
Prop
Type
conditions:
- id: anyOf
args:
conditions:
- id: memberCountAbove
args:
amount: 100
- id: memberCountBelow
args:
amount: 50atLeastOf
Check if at least a certain amount of conditions are true.
Prop
Type
conditions:
- id: atLeastOf
args:
amount: 2
conditions:
- id: memberCountAbove
args:
amount: 100
- id: '!isBot'
- id: 'isUser'
args:
value: "123456789012345678"coinsAbove
Check if a user has more than a certain amount of coins.
Prop
Type
conditions:
- id: coinsAbove
args:
amount: 1000 # Check if the user has more than 1000 coinscoinsBelow
Check if a user has less than a certain amount of coins.
Prop
Type
conditions:
- id: coinsBelow
args:
amount: 1000 # Check if the user has less than 1000 coinshasPermission
Check if a user has a certain permission.
Prop
Type
conditions:
- id: hasPermission
args:
value: "MANAGE_MESSAGES" # Permission name
- id: hasPermission
args:
value:
- "MANAGE_MESSAGES" # Permission name
- "MANAGE_CHANNELS" # Permission namehasRole
Check if a user has a certain role.
Prop
Type
conditions:
- id: hasRole
args:
value: "Admin" # Role ID or name
inherit: true # Optional, if the user have a role higher than the specified role, it will be considered as having the role
- id: hasRole
args:
value:
- "Admin" # Role ID or name
- "Moderator" # Role ID or namehasTag
Check if a forum post has a certain tag.
Prop
Type
conditions:
- id: hasTag
args:
value: "123456789012345678" # Tag ID
- id: hasTag
args:
value:
- "234567890123456789" # Tag ID
- "345678901234567890" # Tag IDinChannel
Check if a message is in a certain channel or category.
Prop
Type
conditions:
- id: inChannel
args:
value:
- "123456789012345678"
- "Example Category"
- id: inChannel
args:
value: "bot-commands"inTicket
Check if a message is in a ticket. Requires Tickets addon.
conditions:
- id: inTicketisBooster
Check if a user is a server booster.
conditions:
- id: isBoosterisBot
Check if a user is a bot.
conditions:
- id: isBot
- 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.
Prop
Type
conditions:
- id: isExpressionTrue
args:
value: "%server_channels% >= 0"isOnCooldown
Check if a user is on cooldown for a certain action.
Prop
Type
conditions:
- id: isOnCooldown
args:
value: "exampleAction" # Action IDisReply
Check if a message is a reply to another message.
conditions:
- id: isReplyisUser
Check if a user is a certain user
Prop
Type
conditions:
- id: isUser
args:
value: "123456789012345678" # User ID
- id: isUser
args:
value:
- "123456789012345678" # User ID
- "987654321098765432" # User IDmatchesRegex
Check if the content of an action matches a certain regex pattern.
Prop
Type
conditions:
- id: matchesRegex
args:
value: "^[a-zA-Z0-9]+$" # Regex pattern
- id: matchesRegex
args:
value: "^[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z]{2,}$" # Regex pattern for email validationmemberCountAbove
Check if the amount of members in a guild is above a certain number.
Prop
Type
conditions:
- id: memberCountAbove
args:
amount: 100memberCountBelow
Check if the amount of members in a guild is below a certain number.
Prop
Type
conditions:
- id: memberCountBelow
args:
amount: 100metaAbove
Check if a meta value is above a certain number. Only works with number type.
Prop
Type
conditions:
- id: metaAbove
args:
key: "exampleMetaKey" # Meta key
value: 100 # Value to check againstmetaBelow
Check if a meta value is below a certain number. Only works with number type.
Prop
Type
conditions:
- id: metaBelow
args:
key: "exampleMetaKey" # Meta key
value: 100 # Value to check againstmetaEquals
Check if a meta value equals a certain value. Only works with number, string, boolean type.
Prop
Type
conditions:
- id: metaEquals
args:
key: "exampleMetaKey" # Meta key
value: "exampleValue" # Value to check againstmetaIncludes
Check if a meta value includes a certain value. Only works with list type.
Prop
Type
conditions:
- id: metaIncludes
args:
key: "exampleMetaKey" # Meta key
value: "exampleValue" # Value to check againsttextContains
Check if the text is contains certain text.
Prop
Type
conditions:
- id: textContains
args:
input: "%message_content%"
output: # Check if the content contains "Hello" or "World"
- "Hello"
- "World"
ignore-case: true # Optional
- id: textContains
args:
input: "%message_content%"
output: "Hello"textEndsWith
Check if the text ends with a certain text.
Prop
Type
conditions:
- id: textEndsWith
args:
input: "%message_content%"
output: # Check if the content ends with "Hello" or "World"
- "Hello"
- "World"
ignore-case: true # Optional
- id: textEndsWith
args:
input: "%message_content%"
output: "Hello"textEquals
Check if the text equals a certain text.
Prop
Type
conditions:
- id: textEquals
args:
input: "%message_content%"
output: # Check if the content is equal to "Hello" or "World"
- "Hello"
- "World"
ignore-case: true # Optional
- id: textEquals
args:
input: "%message_content%"
output: "Hello"textLengthAbove
Check if the text is above a certain length.
Prop
Type
conditions:
- id: textLengthAbove
args:
text: "%message_content%"
amount: 10 # Check if the text length is above 10 characterstextLengthBelow
Check if the text is below a certain length.
Prop
Type
conditions:
- id: textLengthBelow
args:
text: "%message_content%"
amount: 10 # Check if the text length is below 10 characterstextStartsWith
Check if the text starts with a certain text.
Prop
Type
conditions:
- id: textStartsWith
args:
input: "%message_content%"
output:
- "Hello"
- "World"
ignore-case: true # Optional
- id: textStartsWith
args:
input: "%message_content%"
output: "Hello"