From 9e771fa04a8d66392a6fe26aff348fe7da8c592d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 2 Nov 2020 11:13:16 +0600 Subject: [PATCH] fixes --- .../tgbotapi/types/dice/DiceAnimationType.kt | 2 +- .../inmo/tgbotapi/types/message/RawMessage.kt | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt index 89ea0878cf..74ded7764f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt @@ -38,7 +38,7 @@ internal object DiceAnimationTypeSerializer : KSerializer { CubeDiceAnimationType.emoji -> CubeDiceAnimationType DartsDiceAnimationType.emoji -> DartsDiceAnimationType BasketballDiceAnimationType.emoji -> BasketballDiceAnimationType - SlotMachineDiceAnimationType.emoji -> BasketballDiceAnimationType + SlotMachineDiceAnimationType.emoji -> SlotMachineDiceAnimationType else -> CustomDiceAnimationType(type) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt index 4ac90d2823..5f6991b77a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt @@ -220,17 +220,20 @@ internal data class RawMessage( } } ?: content?.let { content -> media_group_id?.let { + val checkedContent = when (content) { + is PhotoContent -> content + is VideoContent -> content + is AudioContent -> content + is DocumentContent -> content + else -> error("Unsupported content for media group") + } when (from) { null -> ChannelMediaGroupMessage( messageId, chat, date.asDate, it, - when (content) { - is PhotoContent -> content - is VideoContent -> content - else -> error("Unsupported content for media group") - }, + checkedContent, edit_date?.asDate, forwarded, reply_to_message?.asMessage, @@ -242,11 +245,7 @@ internal data class RawMessage( chat, date.asDate, it, - when (content) { - is PhotoContent -> content - is VideoContent -> content - else -> error("Unsupported content for media group") - }, + checkedContent, edit_date?.asDate, forwarded, reply_to_message?.asMessage,