public Bus<T extends Bus<T>> extends I18nTranslator
Base methods for the bus.
@NotNull java.lang.String getApplicationId()
The current application id.
@NotNull PlayerId getBotId()
The current bot id.
@NotNull PlayerId getUserId()
The current user id.
@Nullable IntentAware getIntent()
The current intent.
@Nullable java.lang.String getStepName()
The name of the step if any.
int getCurrentAnswerIndex()
The current answer index of the bot for this action.
boolean getTest()
Is it a test mode ?
long defaultDelay(int answerIndex)
Get the default delay between two answers.
@NotNull
T withMessage(@NotNull
ConnectorMessage message)
Adds the specified interface ConnectorMessage to the bus context if the targetConnectorType is compatible.
interface ConnectorMessage,
targetConnectorType@NotNull
T withMessage(@NotNull
ConnectorType connectorType,
@NotNull
kotlin.jvm.functions.Function0<? extends ai.tock.bot.connector.ConnectorMessage> messageProvider)
Adds the specified interface ConnectorMessage to the bus context if the targetConnectorType is compatible.
interface ConnectorMessage,
targetConnectorType@NotNull
T withMessage(@NotNull
ConnectorType connectorType,
@NotNull
java.lang.String connectorId,
@NotNull
kotlin.jvm.functions.Function0<? extends ai.tock.bot.connector.ConnectorMessage> messageProvider)
Adds the specified interface ConnectorMessage to the bus context if the targetConnectorType and connectorId is compatible.
interface ConnectorMessage,
targetConnectorType,
connectorId@NotNull T send(long delay)
Sends previously registered interface ConnectorMessage.
interface ConnectorMessage@NotNull
T send(@NotNull
java.lang.CharSequence i18nText,
long delay,
@NotNull
java.lang.Object... i18nArgs)
Sends i18nText.
@NotNull
T send(@NotNull
java.lang.CharSequence i18nText,
@NotNull
java.lang.Object... i18nArgs)
Sends i18nText.
@NotNull
T send(long delay,
@NotNull
kotlin.jvm.functions.Function1<? super T,? extends java.lang.Object> messageProvider)
Sends messages provided by messageProvider.
if messageProvider returns a CharSequence send it as text. Else call simply send().
messageProvider,
messageProvider,
CharSequence@NotNull
T sendRawText(@Nullable
java.lang.CharSequence plainText,
long delay)
Send text that should not be translated.
@NotNull
T end(@NotNull
java.lang.CharSequence i18nText,
long delay,
@NotNull
java.lang.Object... i18nArgs)
Sends i18nText as last bot answer.
@NotNull
T end(@NotNull
java.lang.CharSequence i18nText,
@NotNull
java.lang.Object... i18nArgs)
Sends i18nText as last bot answer.
@NotNull T end(long delay)
Send previously registered interface ConnectorMessage as last bot answer.
interface ConnectorMessage@NotNull
T end(long delay,
@NotNull
kotlin.jvm.functions.Function1<? super T,? extends java.lang.Object> messageProvider)
Sends messages provided by messageProvider as last bot answer.
if messageProvider returns a CharSequence send it as text. Else call simply end().
messageProvider,
messageProvider,
CharSequence@NotNull
T endRawText(@Nullable
java.lang.CharSequence plainText,
long delay)
Sends text that should not be translated as last bot answer.