public class StoryHandlerBase<T extends StoryHandlerDefinition> implements StoryHandler, IntentAware
Base implementation of interface StoryHandler.
Provides also a convenient implementation of I18nKeyProvider to support i18n.
interface StoryHandlerpublic StoryHandlerBase(@Nullable
java.lang.String mainIntentName,
@NotNull
java.lang.String i18nNamespace,
long breath)
Base implementation of interface StoryHandler.
Provides also a convenient implementation of I18nKeyProvider to support i18n.
mainIntentName - The main intent of the story definition.i18nNamespace - The namespace for I18nKeyProvider implementation.breath - Convenient value to wait before next answer sentence.interface StoryHandlerpublic StoryHandlerBase()
Base implementation of interface StoryHandler.
Provides also a convenient implementation of I18nKeyProvider to support i18n.
interface StoryHandler@NotNull public kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,java.lang.Object> checkPreconditions()
Checks preconditions - if BotBus.end is called,
StoryHandlerDefinition.handle is not called and the handling of bot answer is over.
BotBus.end,
StoryHandlerDefinition.handle@NotNull
public T newHandlerDefinition(@NotNull
BotBus bus,
@Nullable
java.lang.Object data)
Instantiates new instance of T.
@Nullable public <T extends StoryHandlerDefinition> StoryStep<?> selectStepFromStoryHandlerAndData(@NotNull T def, @Nullable java.lang.Object data, @Nullable StoryDefinition storyDefinition)
Selects step from HandlerDef, optional data and interface StoryDefinition.
interface StoryDefinitionpublic void handle(@NotNull
BotBus bus)
Receive a message from the bus.
bus - the bus used to get the message and send the answerpublic double support(@NotNull
BotBus bus)
What is the probability of bot support for the current request?
@Nullable public StoryDefinition findStoryDefinition(@NotNull BotBus bus)
Finds the story definition of this handler.
public void handleAndSwitchStory(@NotNull
BotBus bus)
Handles the action and switches the context to the underlying story definition.
@NotNull
public ai.tock.translator.I18nLabelValue i18n(@NotNull
java.lang.CharSequence defaultLabel,
@NotNull
java.util.List<? extends java.lang.Object> args)
@NotNull
public ai.tock.translator.I18nLabelValue i18nKey(@NotNull
java.lang.String key,
@NotNull
java.lang.CharSequence defaultLabel,
@NotNull
java.lang.Object... args)
Gets an i18n label with the specified key. Current namespace is used for the categorization.
@NotNull public Intent wrappedIntent()
public long getBreath()
Convenient value to wait before next answer sentence.