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

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.

Link copied to clipboard
val Message.telekUserId: Long?

Who sent it, null when nothing did that telek can name — a channel post, an automatic forward. A Keying that wants a per-person key falls back to the chat in that case; see io.github.youndie.telek.ConversationKey.

Functions

Link copied to clipboard
fun TelegramMediaFile.asTelekFileRef(): FileRef

ktgbotapi wraps each id and size in its own value class (FileId, FileUniqueId, FileSize); FileRef carries the plain values a dispatcher can hold, compare and store.

Link copied to clipboard
fun ContentMessage<ContactContent>.asTelekInput(): Contact
fun ContentMessage<DocumentContent>.asTelekInput(): Document
fun ContentMessage<TextContent>.asTelekInput(): Message

fun ContentMessage<LocationContent>.asTelekInput(): Location

Latitude and longitude only, and a live location collapses to the point it was at. telek has no notion of a location that keeps moving — a wizard step that asks "where are you" is answered by a point, and anything richer is a bot's own io.github.youndie.telek.Input.

fun ContentMessage<PhotoContent>.asTelekInput(): Photo

Carries content.media — the size ktgbotapi designates for the collection — and not a pick of telek's own out of mediaCollection. telek does not model photo sizes: a wizard step keeps the photo, and a bot that wants a specific size asks the transport for it.

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 MessageText.asTextSources(): List<TextSource>

This message as ktgbotapi's own text sources.

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

Adapts ktgbotapi updates into telek io.github.youndie.telek.Inputs 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: MessageText, markup: InlineKeyboardMarkup? = null)
fun <S : State> TransitionBuilder<S>.editMessage(chatId: Long, messageId: Long, message: MessageTextBuilder.() -> Unit, keyboard: InlineKeyboardBuilder.() -> Unit? = null)

fun <S : State> TransitionBuilder<S>.editMessage(chatId: Long, messageId: Long, text: String, markup: InlineKeyboardMarkup? = null)

The edit half of the deprecated sendMessage string overload; the same caveats apply.

Link copied to clipboard
fun inlineKeyboard(block: InlineKeyboardBuilder.() -> Unit): InlineKeyboardMarkup
Link copied to clipboard
fun <S : State> TransitionBuilder<S>.sendMessage(chatId: Long, message: MessageText, markup: InlineKeyboardMarkup? = null)
fun <S : State> TransitionBuilder<S>.sendMessage(chatId: Long, message: MessageTextBuilder.() -> Unit, keyboard: InlineKeyboardBuilder.() -> Unit? = null)

fun <S : State> TransitionBuilder<S>.sendMessage(chatId: Long, text: String, markup: InlineKeyboardMarkup? = null)

Sends text for Telegram to parse as legacy Markdown — what every message did before entities.