Sleep

The Sleep action pauses the execution of the current skill for a specified duration. This is useful for introducing delays between actions, such as waiting for external processes to complete or spacing out messages.

Sleep(
    duration: str,
    interruptible: str = "y"
)

Where:

  • duration: The number of seconds to pause execution.
  • interruptible: (Optional) Whether the sleep can be interrupted by incoming events. Set to "y" or "True" to allow interruptions, or "n" or "False" to prevent interruptions. Defaults to "y".

Example 1 (Basic Delay)

{{SendMessage(message="Please wait...")}}

{{Sleep(duration="5")}}

{{SendMessage(message="Done waiting!")}}

The above code snippet sends a message, waits 5 seconds, and then sends another message.

Example 2 (Non-Interruptible Sleep)

{{Sleep(duration="10", interruptible="n")}}

The above code snippet pauses execution for 10 seconds without allowing interruptions from incoming events.