From 270f9a60c112ac7d05c4dca46afa7846c965e8aa Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 20 Nov 2022 13:28:23 +0600 Subject: [PATCH] fixes --- .../commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt | 2 +- .../commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt | 2 +- .../src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt | 2 +- .../commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt | 1 + .../tgbotapi/extensions/utils/formatting/StringFormatting.kt | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt index a3aea3d94c..9b8eedeb5e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt @@ -71,7 +71,7 @@ val User.link: String typealias UserId = ChatId -fun Identifier.toChatId(): IdChatIdentifier = ChatId(this) +fun Identifier.toChatId(): ChatId = ChatId(this) fun Int.toChatId(): IdChatIdentifier = toLong().toChatId() fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt index 20ed573d34..5c93f6ea71 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt @@ -52,7 +52,7 @@ data class ExtendedGroupChatImpl( @Serializable data class ExtendedPrivateChatImpl( @SerialName(idField) - override val id: IdChatIdentifier, + override val id: UserId, @SerialName(photoField) override val chatPhoto: ChatPhoto? = null, @SerialName(usernameField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt index e329c3b015..fa1a075ace 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt @@ -18,7 +18,7 @@ data class GroupChatImpl( @Serializable data class PrivateChatImpl( @SerialName(idField) - override val id: IdChatIdentifier, + override val id: UserId, @SerialName(usernameField) override val username: Username? = null, @SerialName(firstNameField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt index 5df612670a..26a66f446f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt @@ -42,6 +42,7 @@ sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile { get() = false } +@OptIn(RiskFeature::class) object StickerSerializer : KSerializer { override val descriptor: SerialDescriptor = StickerSurrogate.serializer().descriptor diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/StringFormatting.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/StringFormatting.kt index 493870f3e0..21f3279b4c 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/StringFormatting.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/StringFormatting.kt @@ -200,7 +200,7 @@ infix fun String.mention(parseMode: ParseMode): String = when (parseMode) { is MarkdownV2 -> mentionMarkdownV2() } -infix fun Pair.mention(parseMode: ParseMode): String = when (parseMode) { +infix fun Pair.mention(parseMode: ParseMode): String = when (parseMode) { is HTML -> first.textMentionHTML(second) is Markdown -> first.textMentionMarkdown(second) is MarkdownV2 -> first.textMentionMarkdownV2(second)