Package dev.inmo.tgbotapi.extensions.utils.updates.retrieving

Functions

createAccumulatedUpdatesRetrieverFlow
Link copied to clipboard
common
fun TelegramBot.createAccumulatedUpdatesRetrieverFlow(avoidInlineQueries: Boolean = false, avoidCallbackQueries: Boolean = false, exceptionsHandler: ExceptionHandler<Unit>? = null, allowedUpdates: List<String>? = null): Flow<Update>
includeWebhookHandlingInRoute
Link copied to clipboard
fun Route.includeWebhookHandlingInRoute(scope: CoroutineScope, exceptionsHandler: ExceptionHandler<Unit>? = null, mediaGroupsDebounceTimeMillis: Long = 1000L, block: UpdateReceiver<Update>)
Allows to include webhook in custom route everywhere in your server
includeWebhookHandlingInRouteWithFlows
Link copied to clipboard
fun Route.includeWebhookHandlingInRouteWithFlows(scope: CoroutineScope, exceptionsHandler: ExceptionHandler<Unit>? = null, mediaGroupsDebounceTimeMillis: Long = 1000L, block: FlowsUpdatesFilter.() -> Unit)
longPolling
Link copied to clipboard
common
fun TelegramBot.longPolling(flowsUpdatesFilter: FlowsUpdatesFilter, timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null): Job
fun TelegramBot.longPolling(timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null, flowsUpdatesFilterUpdatesKeeperCount: Int = 100, flowUpdatesPreset: FlowsUpdatesFilter.() -> Unit): Job
Will enable longPolling by creating FlowsUpdatesFilter with flowsUpdatesFilterUpdatesKeeperCount as an argument and applied flowUpdatesPreset.
longPollingFlow
Link copied to clipboard
common
fun TelegramBot.longPollingFlow(timeoutSeconds: Seconds = 30, exceptionsHandler: ExceptionHandler<Unit>? = null, allowedUpdates: List<String>? = null): Flow<Update>
retrieveAccumulatedUpdates
Link copied to clipboard
common
fun TelegramBot.retrieveAccumulatedUpdates(flowsUpdatesFilter: FlowsUpdatesFilter, avoidInlineQueries: Boolean = false, avoidCallbackQueries: Boolean = false, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null): Job
fun TelegramBot.retrieveAccumulatedUpdates(avoidInlineQueries: Boolean = false, avoidCallbackQueries: Boolean = false, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null, allowedUpdates: List<String>? = null, updatesReceiver: UpdateReceiver<Update>): Job
setWebhookInfoAndStartListenWebhooks
Link copied to clipboard
suspend fun RequestsExecutor.setWebhookInfoAndStartListenWebhooks(listenPort: Int, engineFactory: ApplicationEngineFactory<*, *>, setWebhookRequest: SetWebhookRequest, exceptionsHandler: ExceptionHandler<Unit> = {}, listenHost: String = "0.0.0.0", listenRoute: String = "/", privateKeyConfig: WebhookPrivateKeyConfig? = null, scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()), mediaGroupsDebounceTimeMillis: Long = 1000L, block: UpdateReceiver<Update>): ApplicationEngine
Setting up ktor server, set webhook info via SetWebhookRequest request.
startGettingOfUpdatesByLongPolling
Link copied to clipboard
common
fun RequestsExecutor.startGettingOfUpdatesByLongPolling(updatesFilter: UpdatesFilter, timeoutSeconds: Seconds = 30, exceptionsHandler: ExceptionHandler<Unit>? = null, scope: CoroutineScope = CoroutineScope(Dispatchers.Default)): Job
fun TelegramBot.startGettingOfUpdatesByLongPolling(timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null, allowedUpdates: List<String>? = null, updatesReceiver: UpdateReceiver<Update>): Job
startListenWebhooks
Link copied to clipboard
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()), mediaGroupsDebounceTimeMillis: Long = 1000L, block: UpdateReceiver<Update>): ApplicationEngine
Setting up ktor server
updateHandlerWithMediaGroupsAdaptation
Link copied to clipboard
common
fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(output: UpdateReceiver<Update>): suspend (Update) -> Unit
Create UpdateReceiver object which will correctly accumulate updates and send into output updates which INCLUDE dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdates.
fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(output: UpdateReceiver<Update>, debounceTimeMillis: Long = 1000L): UpdateReceiver<Update>
Create UpdateReceiver object which will correctly accumulate updates and send into output updates which INCLUDE dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdates.