From ea40474c47511893288c90ee99be3387fd2c5c13 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 15 May 2020 16:53:21 +0600 Subject: [PATCH] add opportunity to set up media groups devounce time --- .../TelegramBotAPI/extensions/api/utils/UpdatesHandling.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/utils/UpdatesHandling.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/utils/UpdatesHandling.kt index 376c88c02a..98d3e67f4f 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/utils/UpdatesHandling.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/utils/UpdatesHandling.kt @@ -17,12 +17,13 @@ import kotlinx.coroutines.launch * @see UpdateReceiver */ fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation( - output: UpdateReceiver + output: UpdateReceiver, + mediaGroupsDebounceMillis: Long = 1000L ): UpdateReceiver { val updatesChannel = Channel(Channel.UNLIMITED) val mediaGroupChannel = Channel>(Channel.UNLIMITED) val mediaGroupAccumulatedChannel = mediaGroupChannel.accumulateByKey( - 1000L, + mediaGroupsDebounceMillis, scope = this )