Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class KtgContext(val bot: TelegramBot) : ExecutionContext
Link copied to clipboard
class KtgContextSource(bot: TelegramBot? = null)

Resolves the KtgContext lazily, once a TelegramBot instance becomes available.

Link copied to clipboard
Link copied to clipboard
annotation class TelegramMessageDsl
Link copied to clipboard

Deliberately a verbatim copy of :telegram's builder of the same name: it only produces a Telegram-flavoured markdown String and has nothing to do with either client library, but sharing it would mean :ktg depending on :telegram (and so on kotlin-telegram-bot). Keep the two in sync when either changes.

Properties

Link copied to clipboard
val Message.telekChatId: Long

ktgbotapi models ids as value classes (ChatId/RawChatId, MessageId); telek keys everything by a plain Long. These adapters are the whole of that translation — they're public so a bot wiring its own update handling (webhooks, a custom FlowsUpdatesFilter) can reuse them instead of going through connect.

Functions

Link copied to clipboard
fun ContentMessage<TextContent>.asTelekInput(): Message

fun DataCallbackQuery.asTelekInput(): Callback?

null for a callback query that has no message attached to it (an inline-mode one), which telek can't key by chatId and therefore can't route.

Link copied to clipboard
fun BehaviourContext.connect(telek: Telek, contextSource: KtgContextSource, answerCallbackQueries: Boolean = true)

Adapts ktgbotapi updates into telek ru.workinprogress.telek.Inputs, keyed by chatId, and feeds the behaviour context's dev.inmo.tgbotapi.bot.TelegramBot to contextSource.

Link copied to clipboard
fun <S : State> TransitionBuilder<S>.editMarkup(chatId: Long, messageId: Long, markup: InlineKeyboardMarkup? = null)
Link copied to clipboard
fun <S : State> TransitionBuilder<S>.editMessage(chatId: Long, messageId: Long, message: TelegramTextBuilder.() -> Unit, keyboard: InlineKeyboardBuilder.() -> Unit? = null)
fun <S : State> TransitionBuilder<S>.editMessage(chatId: Long, messageId: Long, text: String, markup: InlineKeyboardMarkup? = null)
Link copied to clipboard
fun inlineKeyboard(block: InlineKeyboardBuilder.() -> Unit): InlineKeyboardMarkup
Link copied to clipboard
fun <S : State> TransitionBuilder<S>.sendMessage(chatId: Long, message: TelegramTextBuilder.() -> Unit, keyboard: InlineKeyboardBuilder.() -> Unit? = null)
fun <S : State> TransitionBuilder<S>.sendMessage(chatId: Long, text: String, markup: InlineKeyboardMarkup? = null)
Link copied to clipboard