tock / ai.tock.bot.engine / ConnectorController

ConnectorController

interface ConnectorController (source)

Controller to connect Connector and BotDefinition.

Properties

botDefinition

The bot definition served by the controller.

abstract val botDefinition: BotDefinition

connector

The connector used by the controller.

abstract val connector: Connector

connectorType

The type of connector used by the controller.

open val connectorType: ConnectorType

Functions

errorMessage

Returns an error message (technical error).

open fun errorMessage(playerId: PlayerId, applicationId: String, recipientId: PlayerId): Action

handle

Handles an event sent by the connector. the primary goal of this controller.

abstract fun handle(event: Event, data: ConnectorData = ConnectorData(ConnectorCallbackBase(event.applicationId, connector.connectorType))): Unit

notify

Sends a notification to the connector. A BotBus is created and the corresponding story is called.

open fun notify(recipientId: PlayerId, intent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Map<String, String> = emptyMap(), notificationType: ActionNotificationType?, errorListener: (Throwable) -> Unit = {}): Unit

registerServices

Register services at startup.

abstract fun registerServices(serviceIdentifier: String, installer: (Router) -> Unit): Unit

storyDefinitionLoader

Return a story definition provider for this controller.

open fun storyDefinitionLoader(applicationId: String): (String) -> StoryDefinition

support

Return a probability of the support by the bot of this action

abstract fun support(action: Action, data: ConnectorData = ConnectorData(ConnectorCallbackBase(action.applicationId, connector.connectorType))): Double

unregisterServices

Unregister services when Connector is unregistered.

abstract fun unregisterServices(): Unit