tock / ai.tock.bot.connector.slack

Package ai.tock.bot.connector.slack

SlackConnector implementation

Types

SlackClient

object SlackClient

SlackConnector

class SlackConnector : ConnectorBase

Annotations

SlackHandler

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

annotation class SlackHandler

Properties

slackConnectorType

The Slack connector type.

val slackConnectorType: ConnectorType

Functions

attachmentField

fun I18nTranslator.attachmentField(title: String, value: String, short: Boolean = true): AttachmentField

emoji

fun emoji(emoji: SlackEmoji): String

emojiMessage

fun emojiMessage(emoji: SlackEmoji): SlackMessageOut

endForSlack

Sends a Slack message as last bot answer, only if the ConnectorType of the current BotBus is slackConnectorType.

fun <T : Bus<T>> T.endForSlack(delay: Long = defaultDelay(currentAnswerIndex), messageProvider: T.() -> SlackConnectorMessage): T

multiLineMessage

fun I18nTranslator.multiLineMessage(lines: List<CharSequence>, channel: String? = null): SlackMessageOut

sendToSlack

Sends a Slack message only if the ConnectorType of the current BotBus is slackConnectorType.

fun <T : Bus<T>> T.sendToSlack(delay: Long = defaultDelay(currentAnswerIndex), messageProvider: T.() -> SlackConnectorMessage): T

slackAttachment

fun I18nTranslator.slackAttachment(text: CharSequence? = null, vararg buttons: Button): SlackMessageAttachment
fun I18nTranslator.slackAttachment(vararg buttons: Button): SlackMessageAttachment
fun I18nTranslator.slackAttachment(text: CharSequence? = null, buttons: List<Button> = emptyList(), color: String = "good", pretext: String? = null, fallback: String = translate(text).toString(), vararg fields: AttachmentField): SlackMessageAttachment

slackButton

Creates Slack button: https://api.slack.com/reference/messaging/block-elements#button

fun <T : Bus<T>> T.slackButton(title: CharSequence, targetIntent: IntentAware? = null, parameters: Parameters = Parameters(), name: String = "default"): Button

Creates a Slack button: https://api.slack.com/reference/messaging/block-elements#button

fun <T : Bus<T>> T.slackButton(title: CharSequence, targetIntent: IntentAware?, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Parameters = Parameters(), name: String = "default"): Button
fun <T : Bus<T>> T.slackButton(title: CharSequence, targetIntent: IntentAware?, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>, name: String = "default"): Button

slackMessage

fun I18nTranslator.slackMessage(message: CharSequence, vararg attachments: SlackMessageAttachment): SlackMessageOut
fun I18nTranslator.slackMessage(message: CharSequence, channel: String? = null, vararg attachments: SlackMessageAttachment): SlackMessageOut

textMessage

fun I18nTranslator.textMessage(message: CharSequence): SlackMessageOut

withSlack

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

fun <T : Bus<T>> T.withSlack(messageProvider: () -> SlackConnectorMessage): T