Control flow
Add conditions, loops and pauses to your flow.
If
Runs the "then" actions when the condition is true, otherwise runs the "else" actions.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Condition | Yes/No | Yes | Yes/No value to evaluate. |
Branches
| Name | Details |
|---|---|
| Then | Runs when the condition is true. |
| Otherwise | Runs when the condition is false. Optional. |
Switch
Runs the branch whose case value matches the input value.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Value | Text | Yes | Value to compare against the case values. |
Branches
| Name | Details |
|---|---|
| Default case | Runs when no case matches. Optional. |
| Case value | Runs this branch when the input value equals this value. Added by you, one per entry. |
If it has a value
Runs "Has a value" when the value is not empty (an empty text or list still counts as set), with the value available there as never empty, and "Is empty" when it is empty.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Value | Any | Yes | The value to check. |
Branches
| Name | Details |
|---|---|
| Has a value | Runs when the value is set. Provides to its steps: Value (The value, known not to be empty here) |
| Is empty | Runs when the value is empty. Optional. |
Switch on kind
Runs the branch for the kind of value it gets, for a value that can be one of several kinds (a user or a role, one kind of audit log details). Each branch has the value as that kind. A value that is empty runs no branch, not even Other kinds, as with an audit log entry that has no details.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Value | Any | Yes | The value whose kind decides the branch. |
Branches
| Name | Details |
|---|---|
| Other kinds | Runs for every kind without its own branch. It does not run when there is no value, such as an audit log entry without details. Optional. |
| Kind | Runs this branch when the value is this kind. Added by you, one per entry. Provides to its steps: Value (The value, as this branch's kind) |
Branch on subcommand
Runs the branch matching the subcommand (or subcommand group) that invoked this command. The branches are derived automatically from the command's own subcommands - one per invocable subcommand - so there is nothing to add by hand.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Interaction | Slash command | Yes | The slash-command interaction that invoked this flow. |
Branches
| Name | Details |
|---|---|
| Group | The subcommand group this branch matches (empty when the subcommand has no group). Added by you, one per entry. |
| Subcommand | The subcommand this branch matches. Added by you, one per entry. |
For each item
Runs the body once for each item in the list.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Items | List of Any | Yes | List to go through. |
Branches
| Name | Details |
|---|---|
| Body | Runs once per item. Provides to its steps: Item (Current item being iterated), Index (Position of the current item (starting at 0)) |
For each lookup table entry
Runs the body once for each key and value of the lookup table.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Lookup table | Lookup table of Text to Any | Yes | Lookup table to go through. |
Branches
| Name | Details |
|---|---|
| Body | Runs once per entry. Provides to its steps: Key (Current entry's key), Value (Current entry's value) |
Wait
Pauses the flow for the given duration.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Duration | Duration | Yes | How long to wait, up to 30 days. A wait of 5 seconds or more pauses the flow and picks it up again later, even after a restart. Inside a loop, only a few seconds are possible. Value: 0 to 2592000000. Default: 1000. |
Stop flow
Immediately stops the rest of the flow.
Note
A comment shown in the editor. Has no effect at runtime.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Note | Text | Yes | Text of the note. Maximum length: 1000 characters. |
Repeat
Runs the body a fixed number of times.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Times | Whole number | Yes | How often the body runs (1-10000). Value: 1 to 10000. |
Branches
| Name | Details |
|---|---|
| Body | Runs once per iteration. Provides to its steps: Index (Number of the current iteration (starting at 0)) |
Try
Runs the attempt actions; when one of them fails, the error branch runs instead of failing the whole flow.
Branches
| Name | Details |
|---|---|
| Attempt | Actions to try. |
| On error | Runs when an action inside "Attempt" fails. Optional. Provides to its steps: Error code (Machine-readable code of the error), Error message (Human-readable description of the error) |
Random branch
Randomly runs at most one branch based on the branch weights. If the weights add up to less than 100, the remainder is the chance that no branch runs.
Branches
| Name | Details |
|---|---|
| Weight | Chance of this branch running, in percent (0-100). Added by you, one per entry. |
Break loop
Stops the current loop immediately and continues after it. Only valid inside a loop.
Continue loop
Skips the rest of the current iteration and moves on to the next one. Only valid inside a loop.