mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
add opportunity to set up media groups devounce time
This commit is contained in:
parent
1f20ae16aa
commit
ea40474c47
@ -17,12 +17,13 @@ import kotlinx.coroutines.launch
|
|||||||
* @see UpdateReceiver
|
* @see UpdateReceiver
|
||||||
*/
|
*/
|
||||||
fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
|
fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
|
||||||
output: UpdateReceiver<Update>
|
output: UpdateReceiver<Update>,
|
||||||
|
mediaGroupsDebounceMillis: Long = 1000L
|
||||||
): UpdateReceiver<Update> {
|
): UpdateReceiver<Update> {
|
||||||
val updatesChannel = Channel<Update>(Channel.UNLIMITED)
|
val updatesChannel = Channel<Update>(Channel.UNLIMITED)
|
||||||
val mediaGroupChannel = Channel<Pair<String, BaseMessageUpdate>>(Channel.UNLIMITED)
|
val mediaGroupChannel = Channel<Pair<String, BaseMessageUpdate>>(Channel.UNLIMITED)
|
||||||
val mediaGroupAccumulatedChannel = mediaGroupChannel.accumulateByKey(
|
val mediaGroupAccumulatedChannel = mediaGroupChannel.accumulateByKey(
|
||||||
1000L,
|
mediaGroupsDebounceMillis,
|
||||||
scope = this
|
scope = this
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user