From ac5d3214b47e135c1765daf0bf7f7a8fbace50c3 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 23 Mar 2019 15:19:29 +0800 Subject: [PATCH] rewrite handleUpdates --- .../TelegramBotAPI/utils/extensions/UpdatesPoller.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPoller.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPoller.kt index 62914bb9f7..f0dd975b2a 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPoller.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPoller.kt @@ -56,9 +56,13 @@ class UpdatesPoller( } private suspend fun handleUpdates(updates: List) { - updates.forEach { update -> + for (update in updates) { (update as? BaseMessageUpdate) ?.let { - pushMediaGroupUpdate(it) + if (it.data is MediaGroupMessage) { + pushMediaGroupUpdate(it) + } else { + null + } } ?:let { pushMediaGroupUpdate() sendToBlock(update)