KtgContextSource

class KtgContextSource(bot: TelegramBot? = null)

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

Unlike kotlin-telegram-bot, ktgbotapi hands out the TelegramBot instance up front (telegramBot(token)), so the usual wiring is simply KtgContextSource(bot) — the deferred shape is kept for the cases where the executor has to be built before the bot exists (and to mirror :telegram's TelegramContextSource). Share one instance between ktgEffectExecutor and connect so the executor awaits the same bot the behaviour context observes, without ru.workinprogress.telek.Telek needing to own or track it.

Constructors

Link copied to clipboard
constructor(bot: TelegramBot? = null)

Functions

Link copied to clipboard
suspend fun context(): KtgContext
Link copied to clipboard
fun provide(bot: TelegramBot)

Idempotent — the first bot wins, later calls are ignored. Called by connect.