1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-02 14:49:47 +00:00

add opportunity to collect media groups with debounce

This commit is contained in:
2023-03-01 11:55:17 +06:00
parent 4182d8f3fe
commit 5a456bcdbf
5 changed files with 82 additions and 40 deletions

View File

@@ -57,6 +57,7 @@ suspend fun TelegramBot.buildBehaviourWithLongPolling(
timeoutSeconds: Seconds = 30,
autoDisableWebhooks: Boolean = true,
autoSkipTimeoutExceptions: Boolean = true,
mediaGroupsDebounceTimeMillis: Long? = 1000L,
block: BehaviourContextReceiver<Unit>
): Job {
val behaviourContext = buildBehaviour(
@@ -69,6 +70,7 @@ suspend fun TelegramBot.buildBehaviourWithLongPolling(
scope = behaviourContext,
timeoutSeconds = timeoutSeconds,
autoDisableWebhooks = autoDisableWebhooks,
autoSkipTimeoutExceptions = autoSkipTimeoutExceptions
autoSkipTimeoutExceptions = autoSkipTimeoutExceptions,
mediaGroupsDebounceTimeMillis = mediaGroupsDebounceTimeMillis
)
}

View File

@@ -70,6 +70,7 @@ suspend fun telegramBotWithBehaviourAndLongPolling(
timeoutSeconds: Seconds = 30,
autoDisableWebhooks: Boolean = true,
autoSkipTimeoutExceptions: Boolean = true,
mediaGroupsDebounceTimeMillis: Long? = 1000L,
block: BehaviourContextReceiver<Unit>
): Pair<TelegramBot, Job> {
return telegramBot(
@@ -84,6 +85,7 @@ suspend fun telegramBotWithBehaviourAndLongPolling(
timeoutSeconds,
autoDisableWebhooks,
autoSkipTimeoutExceptions,
mediaGroupsDebounceTimeMillis,
block
)
}