From 0840d2e083717c2b1f09ba958c3b0ba3b5e5e6c4 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 18 Aug 2023 23:31:30 +0600 Subject: [PATCH] add emoji_status_expiration_date support in Chat --- .../src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt | 1 + .../kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt | 5 ++++- .../kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) 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 29100932c6..4764f8d400 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 @@ -214,6 +214,7 @@ const val isPremiumField = "is_premium" const val hasPrivateForwardsField = "has_private_forwards" const val hasRestrictedVoiceAndVideoMessagesField = "has_restricted_voice_and_video_messages" const val emojiStatusCustomEmojiIdField = "emoji_status_custom_emoji_id" +const val emojiStatusExpirationDateField = "emoji_status_expiration_date" const val iconCustomEmojiIdField = "icon_custom_emoji_id" const val canJoinGroupsField = "can_join_groups" const val canReadAllGroupMessagesField = "can_read_all_group_messages" 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 5dbadf9633..1cc41715e5 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 @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer import dev.inmo.tgbotapi.utils.RiskFeature +import korlibs.time.DateTime import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonObject @@ -78,7 +79,9 @@ data class ExtendedPrivateChatImpl( @SerialName(hasRestrictedVoiceAndVideoMessagesField) override val hasRestrictedVoiceAndVideoMessages: Boolean = false, @SerialName(emojiStatusCustomEmojiIdField) - override val statusEmojiId: CustomEmojiId? = null + override val statusEmojiId: CustomEmojiId? = null, + @SerialName(emojiStatusExpirationDateField) + override val statusEmojiExpiration: TelegramDate? = null ) : ExtendedPrivateChat typealias ExtendedUser = ExtendedPrivateChatImpl diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt index 9d2bc0bcbe..09ac9d6f4f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.chat import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer +import korlibs.time.DateTime import kotlinx.serialization.Serializable @Serializable(ExtendedChatSerializer.Companion::class) @@ -21,6 +22,7 @@ sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChatWithUsername { val hasPrivateForwards: Boolean val hasRestrictedVoiceAndVideoMessages: Boolean val statusEmojiId: CustomEmojiId? + val statusEmojiExpiration: TelegramDate? val allowCreateUserIdLink: Boolean get() = hasPrivateForwards