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

fix for pushMediaGroupUpdate in UpdatesPoller

This commit is contained in:
InsanusMokrassar 2019-03-14 17:26:50 +08:00
parent 26c67b2f99
commit 9f5d985a71

View File

@ -35,15 +35,15 @@ class UpdatesPoller(
}
}
private suspend fun pushMediaGroupUpdate(mediaGroupUpdate: BaseMessageUpdate? = null) {
val inputMediaGroupId = (mediaGroupUpdate ?.data as? MediaGroupMessage) ?.mediaGroupId
private suspend fun pushMediaGroupUpdate(update: BaseMessageUpdate? = null) {
val inputMediaGroupId = (update ?.data as? MediaGroupMessage) ?.mediaGroupId
if (mediaGroup.isNotEmpty() && inputMediaGroupId ?.equals(mediaGroup.mediaGroupId) != true) {
sendToBlock(listOf(*mediaGroup.toTypedArray()))
mediaGroup.clear()
}
inputMediaGroupId ?.let {
mediaGroup.add(mediaGroupUpdate)
}
mediaGroup.add(update)
} ?: sendToBlock(update ?: return)
}
private suspend fun getUpdates(): List<Update> {