-
- All Implemented Interfaces:
-
ai.tock.bot.engine.I18nTranslator,ai.tock.translator.I18nKeyProvider
public interface Bus<T extends Bus<T>> implements I18nTranslator
A new bus instance is created for each user request.
The bus is used by bot implementations to reply to the user request.
-
-
Method Summary
Modifier and Type Method Description abstract LongdefaultDelay(Integer answerIndex)Get the default delay between two answers. TwithMessage(ConnectorMessage message)Adds the specified ConnectorMessage to the bus context if the targetConnectorType is compatible. abstract TwithMessage(ConnectorType connectorType, Function0<ConnectorMessage> messageProvider)Adds the specified ConnectorMessage to the bus context if the targetConnectorType is compatible. abstract TwithMessage(ConnectorType connectorType, String connectorId, Function0<ConnectorMessage> messageProvider)Adds the specified ConnectorMessage to the bus context if the targetConnectorType and connectorId is compatible. Tsend(Long delay)Sends previously registered ConnectorMessage. Tsend(CharSequence i18nText, Long delay, Object i18nArgs)Sends i18nText. Tsend(CharSequence i18nText, Object i18nArgs)Sends i18nText. Tsend(Long delay, Function1<T, Object> messageProvider)Sends messages provided by messageProvider. abstract TsendRawText(CharSequence plainText, Long delay)Send text that should not be translated. Tend(CharSequence i18nText, Long delay, Object i18nArgs)Sends i18nText as last bot answer. Tend(CharSequence i18nText, Object i18nArgs)Sends i18nText as last bot answer. Tend(Long delay)Send previously registered ConnectorMessage as last bot answer. Tend(Long delay, Function1<T, Object> messageProvider)Sends messages provided by messageProvider as last bot answer. abstract TendRawText(CharSequence plainText, Long delay)Sends text that should not be translated as last bot answer. abstract StringgetApplicationId()The current application id. abstract PlayerIdgetBotId()The current bot id. abstract PlayerIdgetUserId()The current user id. abstract IntentAwaregetIntent()The current intent of the dialog at Bus (ie request) initialization. IntentAwaregetCurrentIntent()abstract StringgetStepName()The name of the step if any. abstract IntegergetCurrentAnswerIndex()The current answer index of the bot for this action. abstract BooleangetTest()Is it a test mode ? abstract LocalegetUserLocale()The current user Locale. abstract UserInterfaceTypegetUserInterfaceType()The current user interface type. abstract ConnectorTypegetTargetConnectorType()The ConnectorType used for the response. abstract StringgetContextId()The current context identifier. -
Methods inherited from class ai.tock.bot.engine.Bus
translate, translate, translate, translateAndReturnBlankAsNull -
Methods inherited from class ai.tock.translator.I18nKeyProvider
equals, hashCode, toString -
Methods inherited from class ai.tock.bot.engine.I18nTranslator
i18n, i18n -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
defaultDelay
abstract Long defaultDelay(Integer answerIndex)
Get the default delay between two answers.
-
withMessage
T withMessage(ConnectorMessage message)
Adds the specified ConnectorMessage to the bus context if the targetConnectorType is compatible.
-
withMessage
abstract T withMessage(ConnectorType connectorType, Function0<ConnectorMessage> messageProvider)
Adds the specified ConnectorMessage to the bus context if the targetConnectorType is compatible.
-
withMessage
abstract T withMessage(ConnectorType connectorType, String connectorId, Function0<ConnectorMessage> messageProvider)
Adds the specified ConnectorMessage to the bus context if the targetConnectorType and connectorId is compatible.
-
send
T send(Long delay)
Sends previously registered ConnectorMessage.
-
send
T send(CharSequence i18nText, Long delay, Object i18nArgs)
Sends i18nText.
-
send
T send(CharSequence i18nText, Object i18nArgs)
Sends i18nText.
-
send
T send(Long delay, Function1<T, Object> messageProvider)
Sends messages provided by messageProvider. if messageProvider returns a CharSequence send it as text. Else call simply send().
-
sendRawText
abstract T sendRawText(CharSequence plainText, Long delay)
Send text that should not be translated.
-
end
T end(CharSequence i18nText, Long delay, Object i18nArgs)
Sends i18nText as last bot answer.
-
end
T end(CharSequence i18nText, Object i18nArgs)
Sends i18nText as last bot answer.
-
end
T end(Long delay)
Send previously registered ConnectorMessage as last bot answer.
-
end
T end(Long delay, Function1<T, Object> messageProvider)
Sends messages provided by messageProvider as last bot answer. if messageProvider returns a CharSequence send it as text. Else call simply end().
-
endRawText
abstract T endRawText(CharSequence plainText, Long delay)
Sends text that should not be translated as last bot answer.
-
getApplicationId
abstract String getApplicationId()
The current application id.
-
getIntent
abstract IntentAware getIntent()
The current intent of the dialog at Bus (ie request) initialization.
-
getCurrentIntent
IntentAware getCurrentIntent()
-
getStepName
abstract String getStepName()
The name of the step if any.
-
getCurrentAnswerIndex
abstract Integer getCurrentAnswerIndex()
The current answer index of the bot for this action.
-
getUserLocale
abstract Locale getUserLocale()
The current user Locale.
-
getUserInterfaceType
abstract UserInterfaceType getUserInterfaceType()
The current user interface type.
-
getTargetConnectorType
abstract ConnectorType getTargetConnectorType()
The ConnectorType used for the response.
-
getContextId
abstract String getContextId()
The current context identifier.
-
-
-
-