From 08b0564dbab779ad3bb23578dbdb90aeb659d5b5 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 16 Mar 2024 20:41:36 +0600 Subject: [PATCH] extract and deprecate MessageIdentifier --- CHANGELOG.md | 2 +- .../commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt | 1 - .../kotlin/dev/inmo/tgbotapi/types/MessageId.kt | 5 ++++- .../tgbotapi/types/chat/ChatMessageReactionUpdated.kt | 9 ++++----- .../types/chat/ChatMessageReactionsCountUpdated.kt | 3 +-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b998bb30a3..080e43114c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ **THIS UPDATE CONTAINS REMOVES OF DEPRECATED THINGS** * `Core`: - * `MessageId` now is `value class` + * `MessageId` now is `value class`. `MessageIdentifier` become deprecated * `MessageThreadId` now is `value class` * `InlineQueryIdentifier` now is `value class` * `MediaGroupIdentifier` now is `value class` diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index bccefcc19f..866cb62c98 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -10,7 +10,6 @@ import kotlinx.serialization.encoding.Encoder import kotlin.jvm.JvmInline typealias Identifier = Long -typealias MessageIdentifier = MessageId typealias ForwardSignature = String typealias ForwardSenderName = String typealias AuthorSignature = ForwardSignature diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageId.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageId.kt index 66f6992de1..710d200709 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageId.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageId.kt @@ -31,4 +31,7 @@ value class MessageId( val long: Long ) -fun Long.asTelegramMessageId() = MessageId(this) \ No newline at end of file +fun Long.asTelegramMessageId() = MessageId(this) + +@Deprecated("Renamed", ReplaceWith("MessageId", "dev.inmo.tgbotapi.types.MessageId")) +typealias MessageIdentifier = MessageId \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated.kt index 96ecb4a24b..fdf65e08ba 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.types.chat -import dev.inmo.tgbotapi.abstracts.WithPreviewChat import dev.inmo.tgbotapi.abstracts.WithPreviewChatAndMessageId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.reactions.Reaction @@ -28,7 +27,7 @@ sealed interface ChatMessageReactionUpdated : WithPreviewChatAndMessageId { @SerialName(chatField) override val chat: PreviewChat, @SerialName(messageIdField) - override val messageId: MessageIdentifier, + override val messageId: MessageId, @SerialName(userField) override val reactedUser: PreviewUser, @Serializable(TelegramDateSerializer::class) @@ -48,7 +47,7 @@ sealed interface ChatMessageReactionUpdated : WithPreviewChatAndMessageId { @SerialName(chatField) override val chat: PreviewChat, @SerialName(messageIdField) - override val messageId: MessageIdentifier, + override val messageId: MessageId, @SerialName(actorChatField) override val reactedChat: PreviewChat, @Serializable(TelegramDateSerializer::class) @@ -68,7 +67,7 @@ sealed interface ChatMessageReactionUpdated : WithPreviewChatAndMessageId { @SerialName(chatField) override val chat: PreviewChat, @SerialName(messageIdField) - override val messageId: MessageIdentifier, + override val messageId: MessageId, @SerialName(actorChatField) override val reactedChat: PreviewChat?, @SerialName(userField) @@ -88,7 +87,7 @@ sealed interface ChatMessageReactionUpdated : WithPreviewChatAndMessageId { @SerialName(chatField) val chat: PreviewChat, @SerialName(messageIdField) - val messageId: MessageIdentifier, + val messageId: MessageId, @SerialName(userField) val reactedUser: PreviewUser? = null, @SerialName(actorChatField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionsCountUpdated.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionsCountUpdated.kt index 313b754fb1..e111453679 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionsCountUpdated.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionsCountUpdated.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.types.chat -import dev.inmo.tgbotapi.abstracts.WithPreviewChat import dev.inmo.tgbotapi.abstracts.WithPreviewChatAndMessageId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.reactions.ReactionsCount @@ -12,7 +11,7 @@ data class ChatMessageReactionsCountUpdated( @SerialName(chatField) override val chat: PreviewChat, @SerialName(messageIdField) - override val messageId: MessageIdentifier, + override val messageId: MessageId, @Serializable(TelegramDateSerializer::class) @SerialName(dateField) val date: TelegramDate,