public BotDefinition
The main interface used to define the behaviour of the bot.
New bots should usually not directly extend this class, but instead extend class BotDefinitionBase.
class BotDefinitionBase@NotNull java.lang.String getBotId()
The main bot id. Must be different for each bot.
@NotNull java.lang.String getNamespace()
The namespace of the bot. It has to be the same namespace than the NLP models.
@NotNull java.lang.String getNlpModelName()
The name of the main nlp model.
@NotNull java.util.List<ai.tock.bot.definition.StoryDefinition> getStories()
The list of each stories.
@NotNull Intent findIntent(@NotNull java.lang.String intent)
Finds an class Intent from an intent name.
class Intent@NotNull StoryDefinition findStoryDefinition(@Nullable IntentAware intent)
Finds a interface StoryDefinition from an class Intent.
interface StoryDefinition,
class Intent@NotNull StoryDefinition findStoryDefinition(@Nullable java.lang.String intent, @Nullable java.lang.String applicationId)
Finds a interface StoryDefinition from an intent name.
intent - the intent nameapplicationId - the optional applicationIdinterface StoryDefinition@NotNull StoryDefinition getUnknownStory()
The unknown story. Used where no valid intent is found.
@NotNull ai.tock.translator.I18nLabelValue getDefaultUnknownAnswer()
The default unknown answer.
@NotNull StoryDefinition getKeywordStory()
To handle keywords - used to bypass nlp.
@Nullable StoryDefinition getHelloStory()
The hello story. Used for first interaction with no other input.
@Nullable StoryDefinition getGoodbyeStory()
The goodbye story. Used when closing the conversation.
@Nullable StoryDefinition getNoInputStory()
The no input story. When user does nothing!
@Nullable StoryDefinition getUserLocationStory()
The story that handles class SendLocation action. If it's null, current intent is used.
class SendLocation@Nullable StoryDefinition getHandleAttachmentStory()
The story that handles class SendAttachment action. If it's null, current intent is used.
class SendAttachment@NotNull EventListener getEventListener()
To handle custom events.
@NotNull Action errorAction(@NotNull PlayerId playerId, @NotNull java.lang.String applicationId, @NotNull PlayerId recipientId)
Called when error occurs. By default send "technical error".
@Nullable StoryDefinition getBotDisabledStory()
To manage deactivation.
boolean disableBot(@NotNull
UserTimeline timeline,
@NotNull
Dialog dialog,
@NotNull
Action action)
Does this action trigger bot deactivation ?
@Nullable StoryDefinition getBotEnabledStory()
To manage reactivation.
boolean enableBot(@NotNull
UserTimeline timeline,
@NotNull
Dialog dialog,
@NotNull
Action action)
Does this action trigger bot activation ?
@NotNull kotlin.jvm.functions.Function1<ai.tock.bot.engine.action.Action,kotlin.Unit> getBotEnabledListener()
Listener invoked when bot is enabled.
boolean hasToPersistAction(@NotNull
UserTimeline timeline,
@NotNull
Action action)
If this method returns true, the action will be added in the stored history.
By default, actions where the bot is not only ai.tock.bot.engine.dialog.EventState.notification are added in the bot history.
@NotNull TestBehaviour getTestBehaviour()
Returns a interface TestBehaviour. Used in Integration Tests.
interface TestBehaviour@NotNull
ai.tock.translator.I18nLabelValue i18n(@NotNull
java.lang.CharSequence defaultLabel,
@NotNull
java.util.List<? extends java.lang.Object> args)
@NotNull
ai.tock.nlp.api.client.model.Entity entity(@NotNull
java.lang.String name,
@Nullable
java.lang.String role)
Returns the entity with the specified name and optional role.
@NotNull I18nTranslator i18nTranslator(@NotNull java.util.Locale userLocale, @NotNull ConnectorType connectorType, @NotNull ai.tock.translator.UserInterfaceType userInterfaceType, @Nullable java.lang.String contextId)
Returns an interface I18nTranslator for the specified userLocale and connectorType.
interface I18nTranslator,
userLocale,
connectorTypelong defaultDelay(int answerIndex)
Get the default delay between two answers.
@Nullable DialogFlowDefinition getFlowDefinition()