1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +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) { private suspend fun pushMediaGroupUpdate(update: BaseMessageUpdate? = null) {
val inputMediaGroupId = (mediaGroupUpdate ?.data as? MediaGroupMessage) ?.mediaGroupId val inputMediaGroupId = (update ?.data as? MediaGroupMessage) ?.mediaGroupId
if (mediaGroup.isNotEmpty() && inputMediaGroupId ?.equals(mediaGroup.mediaGroupId) != true) { if (mediaGroup.isNotEmpty() && inputMediaGroupId ?.equals(mediaGroup.mediaGroupId) != true) {
sendToBlock(listOf(*mediaGroup.toTypedArray())) sendToBlock(listOf(*mediaGroup.toTypedArray()))
mediaGroup.clear() mediaGroup.clear()
} }
inputMediaGroupId ?.let { inputMediaGroupId ?.let {
mediaGroup.add(mediaGroupUpdate) mediaGroup.add(update)
} } ?: sendToBlock(update ?: return)
} }
private suspend fun getUpdates(): List<Update> { private suspend fun getUpdates(): List<Update> {