tock / ai.tock.bot.connector.twitter

Package ai.tock.bot.connector.twitter

Twitter connector implementation

Types

TwitterConnectorCallback

class TwitterConnectorCallback : ConnectorCallbackBase

Annotations

TwitterHandler

To specify ConnectorStoryHandler for Twitter connector. KClass passed as value of this annotation must have a primary constructor with a single not optional StoryHandlerDefinitionBase argument.

annotation class TwitterHandler

Properties

MAX_METADATA

const val MAX_METADATA: Int

MAX_OPTION_DESCRIPTION

const val MAX_OPTION_DESCRIPTION: Int

MAX_OPTION_LABEL

const val MAX_OPTION_LABEL: Int

twitterConnectorType

The Twitter connector type.

val twitterConnectorType: ConnectorType

Functions

directMessage

Creates a direct message with only text

fun <T : Bus<T>> T.directMessage(message: CharSequence): OutcomingEvent

directMessageWithAttachment

Creates a direct message with an attachment

fun <T : Bus<T>> T.directMessageWithAttachment(message: CharSequence, mediaCategory: MediaCategory, contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithAttachment(message: CharSequence, mediaCategory: MediaCategory, contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent

directMessageWithButtons

Creates a direct message with Buttons

fun <T : Bus<T>> T.directMessageWithButtons(message: CharSequence, ctas: List<CTA>): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithButtons(message: CharSequence, vararg ctas: CTA): OutcomingEvent

directMessageWithGIF

Creates a direct message with a gif (Max 15MB)

fun <T : Bus<T>> T.directMessageWithGIF(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithGIF(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithGIF(contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithGIF(contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent

directMessageWithImage

Creates a direct message with an image (Max 5MB)

fun <T : Bus<T>> T.directMessageWithImage(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithImage(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithImage(contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithImage(contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent

directMessageWithOptions

Creates a direct message with quick replies

fun <T : Bus<T>> T.directMessageWithOptions(message: CharSequence, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithOptions(message: CharSequence, vararg options: OptionWithoutDescription): OutcomingEvent

directMessageWithVideo

Creates a direct message with a video (Max 15MB)

fun <T : Bus<T>> T.directMessageWithVideo(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithVideo(message: CharSequence, contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithVideo(contentType: String, bytes: ByteArray, vararg options: Option): OutcomingEvent
fun <T : Bus<T>> T.directMessageWithVideo(contentType: String, bytes: ByteArray, vararg options: OptionWithoutDescription): OutcomingEvent

endIfPublicTwitter

End the conversation only if the visibility is public

fun BotBus.endIfPublicTwitter(): Unit

nlpOption

Creates a NLP Option Quick Reply without description

fun I18nTranslator.nlpOption(label: CharSequence): OptionWithoutDescription
fun I18nTranslator.nlpOption(label: CharSequence, description: CharSequence): Option

option

Creates an Option Quick Reply

fun <T : Bus<T>> T.option(label: CharSequence, description: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>): Option
fun <T : Bus<T>> T.option(label: CharSequence, description: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Map<String, String>): Option

Creates an Option Quick Reply without description

fun <T : Bus<T>> T.option(label: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>): OptionWithoutDescription
fun <T : Bus<T>> T.option(label: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Map<String, String>): OptionWithoutDescription

tweet

Create a tweet

fun BotBus.tweet(message: CharSequence): Tweet

tweetWithInviteForDM

Create a tweet with a link for DM to the account listened

fun BotBus.tweetWithInviteForDM(message: CharSequence, welcomeMessageID: String? = null, defaultMessage: String? = null): Tweet

webUrl

Creates a url button

fun <T : Bus<T>> T.webUrl(label: CharSequence, url: CharSequence): WebUrl

withPublicTwitter

Adds a Twitter ConnectorMessage if the current connector is Twitter and the interface is public. You need to call BotBus.send or BotBus.end later to send this message.

fun BotBus.withPublicTwitter(messageProvider: () -> TwitterPublicConnectorMessage): BotBus

withTwitter

Adds a Twitter ConnectorMessage if the current connector is Twitter and the interface is not public. You need to call BotBus.send or BotBus.end later to send this message.

fun BotBus.withTwitter(messageProvider: () -> TwitterConnectorMessage): BotBus

Adds a Twitter ConnectorMessage if the current connector is Twitter and the current connector is connectorId. You need to call T:BusT.send or T:BusT.end later to send this message.

fun BotBus.withTwitter(connectorId: String, messageProvider: () -> TwitterConnectorMessage): BotBus