public static class Connector.DefaultImpls
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.
public static void unregister(Connector $this, @NotNull ConnectorController controller)
Unregisters the connector.
public static void notify(Connector $this, @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, @Nullable ActionNotificationType notificationType, @NotNull kotlin.jvm.functions.Function1<? super java.lang.Throwable,kotlin.Unit> errorListener)
Sends a notification to the connector.
A interface BotBus is created and the corresponding story is called.
$this - the connector controllercontroller - the recipient identifierrecipientId - the notification intentintent - the optional step targetstep - the optional parametersparameters - notification type if anynotificationType - called when a message has not been deliverederrorListener - called when a message has not been deliveredinterface BotBus@Nullable public static UserPreferences loadProfile(Connector $this, @NotNull ConnectorCallback callback, @NotNull PlayerId userId)
Load user preferences - default implementation returns null.
@Nullable public static UserPreferences refreshProfile(Connector $this, @NotNull ConnectorCallback callback, @NotNull PlayerId userId)
Refresh user preferences - default implementation returns null. Only not null values are taken into account.
@NotNull public static kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,ai.tock.bot.connector.ConnectorMessage> addSuggestions(Connector $this, @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 public static kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,ai.tock.bot.connector.ConnectorMessage> addSuggestions(Connector $this, @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 public static kotlin.jvm.functions.Function1<ai.tock.bot.engine.BotBus,java.util.List> toConnectorMessage(Connector $this, @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.