BotFrame

Data · Workflow node

Update state safely

The Update state safely node as it appears in the workflow editor.

What it does

Change persistent state only when its current value allows it.

BotFrame checks the saved value and applies the requested change as one step. Updated and Unchanged show whether it changed, while Previous value, Value, and Changed provide the result to later nodes.

Typical use

Claim a persistent value once or update it only when its current value matches the expected value.

How to use it

  1. Add it from DataOpen the node library and choose Update state safely from Data.
  2. Connect the workflow pathConnect Flow in, then connect the Updated and Unchanged outcomes to their next steps.
  3. Choose settings and connect valuesSet Expected, Operation, Value, Variable. Connections can also supply values produced by earlier nodes.

Settings

These are the options shown when you add this node. A connected value can replace a setting when the workflow runs.

SettingStarting valueWhat it controls
ExpectedNot setUsed when Expected value is not connected from an earlier node.
Operationset_if_absentChooses the calculation or change this node performs.
ValueEmptyUsed when New value is not connected from an earlier node.
VariableEmptyChooses the saved variable to check or update.

Value connections

Value connections pass information between nodes without changing the order of the workflow. When an input is not connected, BotFrame uses the value selected in the node or details from the starting Discord event when available.

Inputs

Guild IDServer · Defaults to the current server
Optional
User IDUser · Defaults to the member who started the workflow
Optional
Expected valueAny value
Optional
New valueAny value
Required

Outputs

Previous valueAny value
Optional
Current valueAny value
Optional
ChangedTrue / false
Optional

What happens when it runs

BotFrame checks the saved value and applies the requested change as one step. Updated and Unchanged show whether it changed, while Previous value, Value, and Changed provide the result to later nodes.

You can use this item in a published BotFrame workflow. You can also test it in the simulator.

These details match the node currently available in the BotFrame workflow editor.