tock / ai.tock.bot.definition / StoryDefinitionBase

StoryDefinitionBase

open class StoryDefinitionBase : StoryDefinition (source)

Default StoryDefinition implementation.

Constructors

<init>

Default StoryDefinition implementation.

StoryDefinitionBase(name: String, storyHandler: StoryHandler = {} as SimpleStoryHandlerBase, otherStarterIntents: Set<IntentAware> = emptySet(), secondaryIntents: Set<IntentAware> = emptySet(), stepsList: List<StoryStep<out StoryHandlerDefinition>> = emptyList(), unsupportedUserInterface: UserInterfaceType? = null, tags: Set<StoryTag> = emptySet())

Properties

id

An unique identifier for a given bot.

open val id: String

intents

The complete list of intents supported by the story.

open val intents: Set<Intent>

name

val name: String

starterIntents

One or more intents that start the story. Usually, you don't have the same starter intent in two different story definition.

open val starterIntents: Set<Intent>

steps

The root steps of the story.

open val steps: Set<StoryStep<out StoryHandlerDefinition>>

storyHandler

The story handler of the story.

open val storyHandler: StoryHandler

tags

The story definition tags that specify different story types or roles.

open val tags: Set<StoryTag>

unsupportedUserInterfaces

When this story does not support all UserInterfaceTypes.

open val unsupportedUserInterfaces: Set<UserInterfaceType>

Functions

handle

open fun handle(bus: BotBus): Unit

toString

open fun toString(): String

Extension Functions

checkPreconditions

Runs StoryDefinitionBase.checkPreconditions.

fun StoryDefinitionBase.checkPreconditions(bus: BotBus): Any?

selectStepFromData

Runs the select step from Bus phase.

fun StoryDefinitionBase.selectStepFromData(def: HandlerDef<*>, data: Any?): StoryStep<*>?

test

Test a StoryDefinition with a mocked (mockk) BotBus.

fun StoryDefinitionBase.test(bus: BotBus): Unit