1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

add opportunity to set up media groups devounce time

This commit is contained in:
InsanusMokrassar 2020-05-15 16:53:21 +06:00
parent 1f20ae16aa
commit ea40474c47

View File

@ -17,12 +17,13 @@ import kotlinx.coroutines.launch
* @see UpdateReceiver
*/
fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
output: UpdateReceiver<Update>
output: UpdateReceiver<Update>,
mediaGroupsDebounceMillis: Long = 1000L
): UpdateReceiver<Update> {
val updatesChannel = Channel<Update>(Channel.UNLIMITED)
val mediaGroupChannel = Channel<Pair<String, BaseMessageUpdate>>(Channel.UNLIMITED)
val mediaGroupAccumulatedChannel = mediaGroupChannel.accumulateByKey(
1000L,
mediaGroupsDebounceMillis,
scope = this
)