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 )