Configuring an action / script
The configuration of an action is done in the actions
section of the script. Each action has its own set of arguments, triggers, conditions and mutators. The action is executed when the trigger is fired and the conditions are met.
You can have actions in script, custom commands and more.
Example Action Config
actions:
- id: sendMessage
args:
content: "Hello there !"
chance: 0.25 # 25% chance to send the message
triggers:
- everyHour
mutators:
channel: "935421560355946596" # Channel ID or name
conditions:
- id: aboveMembers
args:
amount: 100 # Number of members in the server
The above example will send a message "Hello there !" every hour in the channel with ID 935421560355946596
if the server has more than 100 members. The message will only be sent with a 25% chance.
Understanding the Sections
- Name
id
- Description
The id of the action. You can find the list of all actions here.
- Name
args
- Description
The arguments of the action. Each action has its own set of arguments. There are also some common arguments that can be used in all actions. You can find the list of all default arguments here.
- Name
triggers
- Description
The list of triggers that will trigger the action. You can find the list of all triggers here. The action is executed when the trigger is fired.
- Name
conditions
- Description
The list of conditions that must be met for the action to be executed. You can find the list of all conditions here. The action is executed only if the conditions is met.
- Name
mutators
- Description
The list of mutators that will be applied to the action. You can find the list of all mutators here. The mutators are applied to the action to edit the context of the action.
Optional Arguments
Some actions have optional arguments that can be used to modify the behavior of the action. These arguments are not required, but can be useful in certain situations.
- Name
delay
- Description
The delay in seconds before the action is executed. This can be used to delay the action for a certain amount of time. Default is 0 (no delay).
- Name
chance
- Description
The chance of the action being executed. This can be used to execute the action with a certain probability. Default is 1 (100%).
- Name
cooldown
- Description
The cooldown in seconds before the action can be executed again. This can be used to prevent the action from being executed too frequently.
- Name
every
- Description
Specify the action to activate every X time. This can be used to execute the action every X time.
- Name
actions
- Description
Specific to only some actions. The actions inside will be triggered by the actions. Example:
sendMessage
action can trigger thedeleteMessage
action.actions: - id: sendMessage triggers: - messageCreate args: content: "Hello there !" actions: - id: deleteMessage args: delay: 5
Action Chain
You can chain multiple actions together by using the actions
property. This allows you to execute multiple actions in a single script. The actions are executed in the order they are defined.
With the action chain, multiple actions can be impacted by the same trigger. With the mutators & conditions that apply to all actions in the chain.
actions:
- triggers:
- messageCreate
actions:
- id: reply
args:
content: "Hello there !"
- id: addReaction
args:
value: "✅"
conditions:
- id: inChannel
args:
value: "935421560355946596" # Channel ID or name