tock / ai.tock.bot.definition / BotDefinitionBase

# BotDefinitionBase

`open class BotDefinitionBase : BotDefinition` (source)

Base implementation of BotDefinition.

### Constructors

#### <init> | Constructor intended to be used by an enum. `BotDefinitionBase(botId: String, stories: Array<out StoryDefinition>)` Base implementation of BotDefinition. `BotDefinitionBase(botId: String, namespace: String, stories: List<StoryDefinition>, nlpModelName: String = botId, unknownStory: StoryDefinition = defaultUnknownStory, helloStory: StoryDefinition? = null, goodbyeStory: StoryDefinition? = null, noInputStory: StoryDefinition? = null, botDisabledStory: StoryDefinition? = null, botEnabledStory: StoryDefinition? = null, userLocationStory: StoryDefinition? = null, handleAttachmentStory: StoryDefinition? = null, eventListener: EventListener = EventListenerBase(), keywordStory: StoryDefinition = defaultKeywordStory, flowDefinition: DialogFlowDefinition? = null)`

### Properties

#### botDisabledStory | To manage deactivation. `open val botDisabledStory: StoryDefinition?`
#### botEnabledStory | To manage reactivation. `open val botEnabledStory: StoryDefinition?`
#### botId | The main bot id. Must be different for each bot. `open val botId: String`
#### defaultUnknownAnswer | The default unknown answer. `open val defaultUnknownAnswer: I18nLabelValue`
#### eventListener | To handle custom events. `open val eventListener: EventListener`
#### flowDefinition | `open val flowDefinition: DialogFlowDefinition?`
#### goodbyeStory | The goodbye story. Used when closing the conversation. `open val goodbyeStory: StoryDefinition?`
#### handleAttachmentStory | The story that handles ai.tock.bot.engine.action.SendAttachment action. If it's null, current intent is used. `open val handleAttachmentStory: StoryDefinition?`
#### helloStory | The hello story. Used for first interaction with no other input. `open val helloStory: StoryDefinition?`
#### keywordStory | To handle keywords - used to bypass nlp. `open val keywordStory: StoryDefinition`
#### namespace | The namespace of the bot. It has to be the same namespace than the NLP models. `open val namespace: String`
#### nlpModelName | The name of the main nlp model. `open val nlpModelName: String`
#### noInputStory | The no input story. When user does nothing! `open val noInputStory: StoryDefinition?`
#### stories | The list of each stories. `open val stories: List<StoryDefinition>`
#### unknownStory | The unknown story. Used where no valid intent is found. `open val unknownStory: StoryDefinition`
#### userLocationStory | The story that handles ai.tock.bot.engine.action.SendLocation action. If it's null, current intent is used. `open val userLocationStory: StoryDefinition?`

### Functions

#### toString | `open fun toString(): String`

### Companion Object Properties

#### defaultKeywordStory | The default keywordStory. `val defaultKeywordStory: SimpleStoryDefinition`
#### defaultUnknownStory | The default unknownStory. `val defaultUnknownStory: SimpleStoryDefinition`

### Companion Object Functions

#### deleteKeywordHandler | The default handler used to delete the current user. `fun deleteKeywordHandler(bus: BotBus, sendEnd: Boolean = true): Unit`
#### endTestContextKeywordHandler | The default handler used to cleanup test context. `fun endTestContextKeywordHandler(bus: BotBus, sendEnd: Boolean = true): Unit`
#### getKeyword | Returns a (potential) keyword from the BotBus. `fun getKeyword(bus: BotBus): String?`
#### handleWithKeywordListeners | `fun handleWithKeywordListeners(bus: BotBus, keyword: String?): Boolean`
#### testContextKeywordHandler | The default handler used to handle test context initialization. `fun testContextKeywordHandler(bus: BotBus, sendEnd: Boolean = true): Unit`

### Extension Functions

#### newBusMock | Provides a mock initialized with the specified StoryDefinition. `fun BotDefinition.newBusMock(testContext: TestContext = currentTestContext, story: StoryDefinition = testContext.defaultStoryDefinition(this), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId()): BotBusMock`
#### newBusMockContext | Provides a mock context initialized with the specified StoryDefinition. `fun BotDefinition.newBusMockContext(testContext: TestContext = currentTestContext, story: StoryDefinition = testContext.defaultStoryDefinition(this), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId(), botId: PlayerId = PlayerId("bot", PlayerType.bot), action: Action = SendSentence(userId, this.botId, botId, ""), userInterfaceType: UserInterfaceType = UserInterfaceType.textChat, userPreferences: UserPreferences = UserPreferences(locale = locale)): BotBusMockContext`
#### startNewBusMock | Provides a mock initialized with the specified StoryDefinition and starts the story. `fun BotDefinition.startNewBusMock(testContext: TestContext = currentTestContext, story: StoryDefinition = testContext.defaultStoryDefinition(this), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId()): BotBusMock`

### Inheritors

#### SimpleBotDefinition | A simple BotDefinition. `class SimpleBotDefinition : BotDefinitionBase`