docs / com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates.retrieving

Package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates.retrieving

Extensions for External Classes

(jvm)

com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor

(jvm)

io.ktor.routing.Route

(common)

kotlinx.coroutines.CoroutineScope

Functions

(common)

startGettingFlowsUpdatesByLongPolling

This method will create a new one FlowsUpdatesFilter. This method could be unsafe due to the fact that it will start getting updates IMMEDIATELY. That means that your bot will be able to skip some of them until you will call kotlinx.coroutines.flow.Flow.collect on one of FlowsUpdatesFilter flows. To avoid it, you can pass flowUpdatesPreset lambda - it will be called BEFORE starting updates getting

fun RequestsExecutor.startGettingFlowsUpdatesByLongPolling(timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null, flowsUpdatesFilterUpdatesKeeperCount: Int = 64, flowUpdatesPreset: FlowsUpdatesFilter.() -> Unit = {}): FlowsUpdatesFilter
(common)

startGettingOfUpdatesByLongPolling

fun RequestsExecutor.startGettingOfUpdatesByLongPolling(timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null, allowedUpdates: List<String>? = null, updatesReceiver: UpdateReceiver<Update>): Job
fun RequestsExecutor.startGettingOfUpdatesByLongPolling(updatesFilter: UpdatesFilter, timeoutSeconds: Seconds = 30, exceptionsHandler: ExceptionHandler<Unit>? = null, scope: CoroutineScope = CoroutineScope(Dispatchers.Default)): Job
fun RequestsExecutor.startGettingOfUpdatesByLongPolling(messageCallback: UpdateReceiver<MessageUpdate>? = null, messageMediaGroupCallback: UpdateReceiver<MessageMediaGroupUpdate>? = null, editedMessageCallback: UpdateReceiver<EditMessageUpdate>? = null, editedMessageMediaGroupCallback: UpdateReceiver<EditMessageMediaGroupUpdate>? = null, channelPostCallback: UpdateReceiver<ChannelPostUpdate>? = null, channelPostMediaGroupCallback: UpdateReceiver<ChannelPostMediaGroupUpdate>? = null, editedChannelPostCallback: UpdateReceiver<EditChannelPostUpdate>? = null, editedChannelPostMediaGroupCallback: UpdateReceiver<EditChannelPostMediaGroupUpdate>? = null, chosenInlineResultCallback: UpdateReceiver<ChosenInlineResultUpdate>? = null, inlineQueryCallback: UpdateReceiver<InlineQueryUpdate>? = null, callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null, shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null, preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null, pollCallback: UpdateReceiver<PollUpdate>? = null, pollAnswerCallback: UpdateReceiver<PollAnswerUpdate>? = null, timeoutSeconds: Seconds = 30, exceptionsHandler: ExceptionHandler<Unit>? = null, scope: CoroutineScope = GlobalScope): Job
fun RequestsExecutor.startGettingOfUpdatesByLongPolling(messageCallback: UpdateReceiver<MessageUpdate>? = null, mediaGroupCallback: UpdateReceiver<MediaGroupUpdate>? = null, editedMessageCallback: UpdateReceiver<EditMessageUpdate>? = null, channelPostCallback: UpdateReceiver<ChannelPostUpdate>? = null, editedChannelPostCallback: UpdateReceiver<EditChannelPostUpdate>? = null, chosenInlineResultCallback: UpdateReceiver<ChosenInlineResultUpdate>? = null, inlineQueryCallback: UpdateReceiver<InlineQueryUpdate>? = null, callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null, shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null, preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null, pollCallback: UpdateReceiver<PollUpdate>? = null, pollAnswerCallback: UpdateReceiver<PollAnswerUpdate>? = null, timeoutSeconds: Seconds = 30, exceptionsHandler: ExceptionHandler<Unit>? = null, scope: CoroutineScope = CoroutineScope(Dispatchers.Default)): Job
(jvm)

startListenWebhooks

Setting up ktor server, set webhook info via SetWebhook request.

fun startListenWebhooks(listenPort: Int, engineFactory: ApplicationEngineFactory<*, *>, exceptionsHandler: ExceptionHandler<Unit>, listenHost: String = "0.0.0.0", listenRoute: String? = null, privateKeyConfig: WebhookPrivateKeyConfig? = null, scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()), block: UpdateReceiver<Update>): ApplicationEngine