From 7414a9b41b026e9dcc2faefbab3b9cad980e6c04 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 11 Mar 2021 16:00:47 +0600 Subject: [PATCH] chatmember serializers are public --- CHANGELOG.md | 4 +++- .../types/ChatMember/abstracts/AdministratorChatMember.kt | 4 +++- .../inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt | 4 +++- .../commonMain/kotlin/dev/inmo/tgbotapi/utils/Annotations.kt | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b96231b661..355c8a83e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,10 @@ * `Common`: * `Version`: * `MicroUtils`: `0.4.28` -> `0.4.29` +* `Core`: + * `AdministratorChatMemberSerializer` and `ChatMemberSerializer` has changed their visibility: they are public for now * `Behaviour Builder`: - * Now content triggers and expectaters will wait for channel posts too + * Now content triggers and expectators will wait for channel posts too ## 0.32.9 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt index ab6e9056f6..cd05b4e9c9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt @@ -1,5 +1,6 @@ package dev.inmo.tgbotapi.types.ChatMember.abstracts +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder @@ -20,7 +21,8 @@ interface AdministratorChatMember : SpecialRightsChatMember { } @Serializer(AdministratorChatMember::class) -internal object AdministratorChatMemberSerializer : KSerializer { +@RiskFeature +object AdministratorChatMemberSerializer : KSerializer { override val descriptor: SerialDescriptor = ChatMemberSerializer.descriptor override fun deserialize(decoder: Decoder): AdministratorChatMember = ChatMemberSerializer.deserialize(decoder) as AdministratorChatMember diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt index 8f4b9a88d1..d7c3f9b0ce 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.ChatMember.abstracts import dev.inmo.tgbotapi.types.ChatMember.* import dev.inmo.tgbotapi.types.User import dev.inmo.tgbotapi.types.statusField +import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor @@ -17,7 +18,8 @@ interface ChatMember { } @Serializer(ChatMember::class) -internal object ChatMemberSerializer : KSerializer { +@RiskFeature +object ChatMemberSerializer : KSerializer { override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor override fun deserialize(decoder: Decoder): ChatMember { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/Annotations.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/Annotations.kt index 2d516c712a..421b12ba5b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/Annotations.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/Annotations.kt @@ -35,4 +35,4 @@ const val lowLevelRiskFeatureMessage = "This method is low-level and not recomme AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE_PARAMETER ) -annotation class RiskFeature(val message: String) +annotation class RiskFeature(val message: String = lowLevelRiskFeatureMessage)