tock / ai.tock.bot.definition / StoryDataStep

# StoryDataStep

`interface StoryDataStep<T : StoryHandlerDefinition, TD, D> : StoryStep<T>` (source)

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

### Parameters

`T` - StoryDef

`TD` - the data of the StoryDef

`D` - the data of the step

### 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?`
#### checkPreconditions | Checks preconditions - if BotBus.end is called, StoryHandlerDefinition.handle is not called and the handling of bot answer is over. Returned data is used in subsequent call of handler if not null `open fun checkPreconditions(): T.(TD?) -> D?`
#### handler | The custom handler for this step. When returning a null value, it means that the step is not able to answer to the current request. `open fun handler(): T.(D?) -> Any?`
#### selectFromBusAndData | 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 selectFromBusAndData(): T.(TD?) -> Boolean`

### Inheritors

#### StoryDataStepBase | Base class for StoryDataStep implementations. `abstract class StoryDataStepBase<T : StoryHandlerDefinition, TD, D> : StoryDataStep<T, TD, D>`