public Connector
A connector connects bots to users via a dedicated interface (like Messenger, Google Assistant, Slack... ).
There is one Connector for each user front-end application.
See ai.tock.bot.connector.messenger.MessengerConnector or ai.tock.bot.connector.ga.GAConnector for examples of interface Connector implementations.
| Modifier and Type | Interface and Description |
|---|---|
static class |
Connector.DefaultImpls
A connector connects bots to users via a dedicated interface (like Messenger, Google Assistant, Slack... ).
|
| Modifier and Type | Method and Description |
|---|---|
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,ai.tock.bot.connector.ConnectorMessage> |
addSuggestions(java.lang.CharSequence text,
java.util.List<? extends java.lang.CharSequence> suggestions)
Returns a
interface ConnectorMessage with the specified list of suggestions.
If the connector does not support suggestions, returns null. |
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,ai.tock.bot.connector.ConnectorMessage> |
addSuggestions(ConnectorMessage message,
java.util.List<? extends java.lang.CharSequence> suggestions)
Updates a
interface ConnectorMessage with the specified list of suggestions.
Default returns message unmodified. |
ConnectorType |
getConnectorType()
The type of the connector.
|
UserPreferences |
loadProfile(ConnectorCallback callback,
PlayerId userId)
Load user preferences - default implementation returns null.
|
void |
notify(ConnectorController controller,
PlayerId recipientId,
IntentAware intent,
StoryStep<? extends ai.tock.bot.definition.StoryHandlerDefinition> step,
java.util.Map<java.lang.String,java.lang.String> parameters,
ActionNotificationType notificationType)
Sends a notification to the connector.
A
interface BotBus is created and the corresponding story is called. |
UserPreferences |
refreshProfile(ConnectorCallback callback,
PlayerId userId)
Refresh user preferences - default implementation returns null.
Only not null values are taken into account.
|
void |
register(ConnectorController controller)
Registers the connector for the specified controller.
|
void |
send(Event event,
ConnectorCallback callback,
long delayInMs)
Send an event with this connector for the specified delay.
|
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,java.util.List> |
toConnectorMessage(MediaMessage message)
Maps a
interface MediaMessage into a interface ConnectorMessage.
If toConnectorMessage returns an empty list, the mapping is not supported for this connector.
Default returns an empty list. |
void |
unregister(ConnectorController controller)
Unregisters the connector.
|
@NotNull ConnectorType getConnectorType()
The type of the connector.
void register(@NotNull
ConnectorController controller)
Registers the connector for the specified controller.
void unregister(@NotNull
ConnectorController controller)
Unregisters the connector.
void send(@NotNull
Event event,
@NotNull
ConnectorCallback callback,
long delayInMs)
Send an event with this connector for the specified delay.
event - the event to sendcallback - the initial connector callbackdelayInMs - the optional delayvoid notify(@NotNull
ConnectorController controller,
@NotNull
PlayerId recipientId,
@NotNull
IntentAware intent,
@Nullable
StoryStep<? extends ai.tock.bot.definition.StoryHandlerDefinition> step,
@NotNull
java.util.Map<java.lang.String,java.lang.String> parameters,
@NotNull
ActionNotificationType notificationType)
Sends a notification to the connector.
A interface BotBus is created and the corresponding story is called.
recipientId - the recipient identifierintent - the notification intentstep - the optional step targetparameters - the optional parametersinterface BotBus@Nullable UserPreferences loadProfile(@NotNull ConnectorCallback callback, @NotNull PlayerId userId)
Load user preferences - default implementation returns null.
@Nullable UserPreferences refreshProfile(@NotNull ConnectorCallback callback, @NotNull PlayerId userId)
Refresh user preferences - default implementation returns null. Only not null values are taken into account.
@NotNull
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,ai.tock.bot.connector.ConnectorMessage> addSuggestions(@NotNull
java.lang.CharSequence text,
@NotNull
java.util.List<? extends java.lang.CharSequence> suggestions)
Returns a interface ConnectorMessage with the specified list of suggestions.
If the connector does not support suggestions, returns null.
interface ConnectorMessage@NotNull
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,ai.tock.bot.connector.ConnectorMessage> addSuggestions(@NotNull
ConnectorMessage message,
@NotNull
java.util.List<? extends java.lang.CharSequence> suggestions)
Updates a interface ConnectorMessage with the specified list of suggestions.
Default returns message unmodified.
interface ConnectorMessage,
message@NotNull
kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,java.util.List> toConnectorMessage(@NotNull
MediaMessage message)
Maps a interface MediaMessage into a interface ConnectorMessage.
If toConnectorMessage returns an empty list, the mapping is not supported for this connector.
Default returns an empty list.