Control Flow
workflowResponse
$workflowResponse
The $workflowResponse function returns information about the last workflow run with $callWorkflow.
Syntax
$workflowResponse[(property)]
Parameters
| Parameter | Description |
|---|---|
property |
Optional - Name of a result of the last workflow (trimmed). Without it (or when empty), the status of the last call is returned. |
$workflowResponse takes 0 or 1 argument.
Return Value
- Type: String
- Without argument:
WORKFLOW_OK:followed by the entry point of the workflow that was called (for exampleWORKFLOW_OK:main). - With
property: the named result of the last workflow (for a BDFD script workflow,outputis the text it produced andscriptisBDFD_OK); an empty string if there is none. - An empty string if no workflow has been called yet.
Behavior
- The values are set by each successful
$callWorkflow[name;...]call; the results of the previous call are removed first. - A workflow that stops the script also stops the calling script.
Examples
Call and retrieve the status
$callWorkflow[dailyReward;user=$authorID]
Workflow status: $workflowResponse
Read the output of a script workflow
$callWorkflow[calculSalaire;user=$authorID]
Your calculated salary: $workflowResponse[output]
Chain of workflows
$callWorkflow[verifyUser;user=$authorID]
$if[$workflowResponse[output]==ok]
$callWorkflow[processOrder;user=$authorID]
Order processed: $workflowResponse
$else
Verification failed.
$endif
Notes
$workflowResponseis overwritten with each new call to$callWorkflow.- Store the value in a temporary variable if you need to reuse it:
$var[rep;$workflowResponse[output]]. - Arguments are passed to
$callWorkflowasname=value(or positionally). - These examples assume the workflows named in them exist in the bot.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.