Interface Bus
-
- 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. abstract BooleanisCompatibleWith(ConnectorType connectorType)Is the targetConnectorType compatible with connectorType 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. abstract TsendDebugData(String title, Object data)Send debug data. 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 ? -
Methods inherited from class ai.tock.bot.engine.I18nTranslator
getContextId, getSourceConnectorType, getTargetConnectorType, getUserInterfaceType, getUserLocale, translate, translate, translate, translateAndReturnBlankAsNull -
Methods inherited from class ai.tock.translator.I18nKeyProvider
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.
-
isCompatibleWith
abstract Boolean isCompatibleWith(ConnectorType connectorType)
Is the targetConnectorType compatible with connectorType
-
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.
-
sendDebugData
abstract T sendDebugData(String title, Object data)
Send debug data.
-
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.
-
-
-
-