tock / ai.tock.bot.definition / StoryStep

StoryStep

interface StoryStep<T : StoryHandlerDefinition> (source)

A step is a part of a StoryDefinition. Used to manage workflow in a StoryHandler.

Properties

baseIntent

Returns intent or the StoryDefinition.mainIntent if intent is null.

open val baseIntent: IntentAware

children

The optional children of the step.

open val children: Set<StoryStep<T>>

entityStepSelection

If not null, entity has to be set in the current action to trigger the step.

open val entityStepSelection: EntityStepSelection?

hasNoChildren

Flag indicating if it's the step has no children.

open val hasNoChildren: Boolean

intent

The main intent of the step. If not null and if the current intent is equals to intent, this step will be automatically selected to be the current step.

open val intent: IntentAware?

name

The name of the step.

abstract val name: String

otherStarterIntents

Same behaviour than intent in the rare case when the step handle more than one intent.

open val otherStarterIntents: Set<IntentAware>

secondaryIntents

The secondary intents of this step. If detected and if the current step is this step, the current step remains this step.

open val secondaryIntents: Set<IntentAware>

Functions

answer

The custom answer for this step. When returning a null value, it means that the step is not able to answer to the current request.

open fun answer(): T.() -> Any?

selectFromAction

Does this Step has to be automatically selected from the action context? if returns true, the step is selected.

open fun selectFromAction(userTimeline: UserTimeline, dialog: Dialog, action: Action, intent: Intent?): Boolean

selectFromActionAndEntityStepSelection

Does this step hast to be selected from its entityStepSelection? Returns null if there is no entityStepSelection.

open fun selectFromActionAndEntityStepSelection(action: Action, intent: Intent? = null): Boolean?

selectFromBus

Does this Step has to be selected from the Bus? This method is called if StoryHandlerBase.checkPreconditions does not call BotBus.end. If this functions returns true, the step is selected and remaining steps are not tested.

open fun selectFromBus(): BotBus.() -> Boolean

selectFromDialog

Does this Step has to be automatically selected from the dialog context? if returns true, the step is selected.

open fun selectFromDialog(userTimeline: UserTimeline, dialog: Dialog, intent: Intent?): Boolean

selectFromDialogAndEntityStepSelection

Does this step hast to be selected from its entityStepSelection? Returns null if there is no entityStepSelection.

open fun selectFromDialogAndEntityStepSelection(dialog: Dialog, intent: Intent? = null): Boolean?

supportIntent

Does this step support this intent?

open fun supportIntent(i: Intent): Boolean

supportStarterIntent

Does this step support this intent as starter intent?

open fun supportStarterIntent(i: Intent): Boolean

Inheritors

SimpleStoryStep

StoryStep without custom StoryHandlerDefinition.

interface SimpleStoryStep : StoryStep<StoryHandlerDefinition>

StoryDataStep

A step that can have specific preconditions and can use input data object in handler.

interface StoryDataStep<T : StoryHandlerDefinition, TD, D> : StoryStep<T>