Package-level declarations

Functions

Link copied to clipboard
fun TelegramBot.createAccumulatedUpdatesRetrieverFlow(avoidInlineQueries: Boolean = false, avoidCallbackQueries: Boolean = false, exceptionsHandler: ExceptionHandler<Unit>? = null, allowedUpdates: List<String>? = ALL_UPDATES_LIST, autoDisableWebhooks: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000): Flow<Update>
Link copied to clipboard
suspend fun TelegramBot.flushAccumulatedUpdates(avoidInlineQueries: Boolean = false, avoidCallbackQueries: Boolean = false, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), allowedUpdates: List<String>? = ALL_UPDATES_LIST, exceptionsHandler: ExceptionHandler<Unit>? = null, autoDisableWebhooks: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, updatesReceiver: UpdateReceiver<Update> = {})
Link copied to clipboard
fun Route.includeWebhookHandlingInRoute(scope: CoroutineScope, exceptionsHandler: ExceptionHandler<Unit>? = null, mediaGroupsDebounceTimeMillis: Long = 1000, block: UpdateReceiver<Update>)

Allows to include webhook in custom route everywhere in your server

Link copied to clipboard
fun Route.includeWebhookHandlingInRouteWithFlows(scope: CoroutineScope, exceptionsHandler: ExceptionHandler<Unit>? = null, mediaGroupsDebounceTimeMillis: Long = 1000, block: FlowsUpdatesFilter.() -> Unit)
Link copied to clipboard
fun TelegramBot.longPolling(updatesFilter: UpdatesFilter, timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), autoDisableWebhooks: Boolean = true, autoSkipTimeoutExceptions: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, exceptionsHandler: ExceptionHandler<Unit>? = null): Job

Will startGettingOfUpdatesByLongPolling using incoming updatesFilter. It is assumed that you ALREADY CONFIGURE all updates receivers, because this method will trigger getting of updates and.

fun TelegramBot.longPolling(timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null, flowsUpdatesFilterUpdatesKeeperCount: Int = 100, autoDisableWebhooks: Boolean = true, autoSkipTimeoutExceptions: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, flowUpdatesPreset: FlowsUpdatesFilter.() -> Unit): Job

Will enable longPolling by creating FlowsUpdatesFilter with flowsUpdatesFilterUpdatesKeeperCount as an argument and applied flowUpdatesPreset. It is assumed that you WILL CONFIGURE all updates receivers in flowUpdatesPreset, because of after flowUpdatesPreset method calling will be triggered getting of updates.

Link copied to clipboard
fun TelegramBot.longPollingFlow(timeoutSeconds: Seconds = 30, exceptionsHandler: ExceptionHandler<Unit>? = null, allowedUpdates: List<String>? = ALL_UPDATES_LIST, autoDisableWebhooks: Boolean = true, autoSkipTimeoutExceptions: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000): Flow<Update>
Link copied to clipboard
fun TelegramBot.retrieveAccumulatedUpdates(flowsUpdatesFilter: FlowsUpdatesFilter, avoidInlineQueries: Boolean = false, avoidCallbackQueries: Boolean = false, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), autoDisableWebhooks: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, 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>? = ALL_UPDATES_LIST, autoDisableWebhooks: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, updatesReceiver: UpdateReceiver<Update>): Job
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 = 1000, additionalApplicationEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, block: UpdateReceiver<Update>): ApplicationEngine

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

Link copied to clipboard
fun RequestsExecutor.startGettingOfUpdatesByLongPolling(updatesFilter: UpdatesFilter, timeoutSeconds: Seconds = 30, exceptionsHandler: ExceptionHandler<Unit>? = null, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), autoDisableWebhooks: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, autoSkipTimeoutExceptions: Boolean = true): Job
fun TelegramBot.startGettingOfUpdatesByLongPolling(timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), exceptionsHandler: ExceptionHandler<Unit>? = null, allowedUpdates: List<String>? = ALL_UPDATES_LIST, autoDisableWebhooks: Boolean = true, autoSkipTimeoutExceptions: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, updatesReceiver: UpdateReceiver<Update>): Job
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 = 1000, additionalApplicationEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, block: UpdateReceiver<Update>): ApplicationEngine

Setting up ktor server

Link copied to clipboard
fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(output: UpdateReceiver<Update>): suspend (Update) -> Unit
fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(output: UpdateReceiver<Update>, debounceTimeMillis: Long = 1000): UpdateReceiver<Update>

Create UpdateReceiver object which will correctly accumulate updates and send into output updates which INCLUDE dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdates.