diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggersUnhandled.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggersUnhandled.kt index ef0c85a334..22f4fd4bdb 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggersUnhandled.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggersUnhandled.kt @@ -55,7 +55,7 @@ suspend fun BC.onUnhandledInlineMessageIdDataCallbackQue markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery ( - initialFilter * !SimpleFilter { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) }, + initialFilter * !SimpleFilter { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) }, subcontextUpdatesFilter, markerFactory, scenarioReceiver diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPublicResults.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPublicResults.kt index b908d2e314..85e9b9a5f6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPublicResults.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPublicResults.kt @@ -20,7 +20,7 @@ sealed interface GiveawayPublicResults: GiveawayInfo, GiveawayResults, WithPrevi val publicWinners: Boolean val refunded: Boolean - @Serializable(GiveawayPublicResults.Companion::class) + @Serializable data class Refunded( @SerialName(chatsField) override val chat: PreviewChat, @@ -50,7 +50,7 @@ sealed interface GiveawayPublicResults: GiveawayInfo, GiveawayResults, WithPrevi override val premiumMonths: Int? = null } - @Serializable(GiveawayPublicResults.Companion::class) + @Serializable data class Winners ( @SerialName(chatsField) override val chat: PreviewChat, @@ -157,6 +157,5 @@ sealed interface GiveawayPublicResults: GiveawayInfo, GiveawayResults, WithPrevi Surrogate.serializer().serialize(encoder, surrogate) } - } } \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt index c7894c973c..8b1e3fe515 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt @@ -48,6 +48,7 @@ internal data class RawUpdate constructor( private val chat_boost: ChatBoostUpdated? = null, private val removed_chat_boost: ChatBoostRemoved? = null ) { + @Transient private var initedUpdate: Update? = null /** * @return One of children of [Update] interface or null in case of unknown type of update diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MigratedToSupergroupTest.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MigratedToSupergroupTest.kt index e771587cfc..d610b9cb28 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MigratedToSupergroupTest.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/MigratedToSupergroupTest.kt @@ -1,9 +1,7 @@ package dev.inmo.tgbotapi.types.message.ChatEvents import dev.inmo.tgbotapi.TestsJsonFormat -import dev.inmo.tgbotapi.extensions.utils.asMessageUpdate -import dev.inmo.tgbotapi.extensions.utils.asMigratedToSupergroup -import dev.inmo.tgbotapi.extensions.utils.asSupergroupEventMessage +import dev.inmo.tgbotapi.extensions.utils.* import dev.inmo.tgbotapi.types.IdChatIdentifier import dev.inmo.tgbotapi.types.update.abstracts.UpdateDeserializationStrategy import kotlin.test.Test @@ -41,9 +39,9 @@ class MigratedToSupergroupTest { } """.trimIndent() val update = TestsJsonFormat.decodeFromString(UpdateDeserializationStrategy, payload) - val message = update.asMessageUpdate() ?: fail("update should be of MessageUpdate subtype") - val data = message.data.asSupergroupEventMessage() ?: fail("message should be of SupergroupEventMessage subtype") - val event = data.chatEvent.asMigratedToSupergroup() ?: fail("event should be of SupergroupChatCreated subtype") + val message = update.messageUpdateOrThrow() + val data = message.data.supergroupEventMessageOrThrow() + val event = data.chatEvent.migratedToSupergroupOrThrow() assertEquals(IdChatIdentifier(57005), event.migratedFrom) }