From 430240a6ad24ee3b1d4ce3543731e0230c3b94bd Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 4 Jan 2024 18:06:40 +0600 Subject: [PATCH] add emoji status in the most extended chats --- .../dev/inmo/tgbotapi/types/chat/Extended.kt | 24 +++++++++++++++---- .../tgbotapi/types/chat/ExtendedAbstracts.kt | 22 ++++++++++------- 2 files changed, 33 insertions(+), 13 deletions(-) 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 017e3be087..aba9e0e404 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 @@ -35,7 +35,11 @@ data class ExtendedChannelChatImpl( @SerialName(hasHiddenMembersField) override val membersHidden: Boolean = false, @SerialName(availableReactionsField) - override val availableReactions: List? = null + override val availableReactions: List? = null, + @SerialName(emojiStatusCustomEmojiIdField) + override val statusEmojiId: CustomEmojiId? = null, + @SerialName(emojiStatusExpirationDateField) + override val statusEmojiExpiration: TelegramDate? = null ) : ExtendedChannelChat @Serializable @@ -59,7 +63,11 @@ data class ExtendedGroupChatImpl( @SerialName(hasHiddenMembersField) override val membersHidden: Boolean = false, @SerialName(availableReactionsField) - override val availableReactions: List? = null + override val availableReactions: List? = null, + @SerialName(emojiStatusCustomEmojiIdField) + override val statusEmojiId: CustomEmojiId? = null, + @SerialName(emojiStatusExpirationDateField) + override val statusEmojiExpiration: TelegramDate? = null ) : ExtendedGroupChat @Serializable @@ -132,7 +140,11 @@ data class ExtendedSupergroupChatImpl( @SerialName(hasHiddenMembersField) override val membersHidden: Boolean = false, @SerialName(availableReactionsField) - override val availableReactions: List? = null + override val availableReactions: List? = null, + @SerialName(emojiStatusCustomEmojiIdField) + override val statusEmojiId: CustomEmojiId? = null, + @SerialName(emojiStatusExpirationDateField) + override val statusEmojiExpiration: TelegramDate? = null ) : ExtendedSupergroupChat @Serializable @@ -176,7 +188,11 @@ data class ExtendedForumChatImpl( @SerialName(hasHiddenMembersField) override val membersHidden: Boolean = false, @SerialName(availableReactionsField) - override val availableReactions: List? = null + override val availableReactions: List? = null, + @SerialName(emojiStatusCustomEmojiIdField) + override val statusEmojiId: CustomEmojiId? = null, + @SerialName(emojiStatusExpirationDateField) + override val statusEmojiExpiration: TelegramDate? = null ) : ExtendedForumChat @Serializable 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 36092957be..16be3e7ee4 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 @@ -7,6 +7,17 @@ import dev.inmo.tgbotapi.types.reactions.Reaction import korlibs.time.DateTime import kotlinx.serialization.Serializable +@Serializable(ExtendedChatSerializer.Companion::class) +sealed interface ExtendedChat : Chat { + val chatPhoto: ChatPhoto? +} + +@Serializable(ExtendedChatSerializer.Companion::class) +sealed interface ExtendedNonBotChat : ExtendedChat { + val statusEmojiId: CustomEmojiId? + val statusEmojiExpiration: TelegramDate? +} + @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedChannelChat : ChannelChat, ExtendedPublicChat, ExtendedChatWithUsername { val linkedGroupChatId: IdChatIdentifier? @@ -18,18 +29,16 @@ sealed interface ExtendedGroupChat : GroupChat, ExtendedPublicChat { } @Serializable(ExtendedChatSerializer.Companion::class) -sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChatWithUsername { +sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChatWithUsername, ExtendedNonBotChat { val bio: String val hasPrivateForwards: Boolean val hasRestrictedVoiceAndVideoMessages: Boolean - val statusEmojiId: CustomEmojiId? - val statusEmojiExpiration: TelegramDate? val allowCreateUserIdLink: Boolean get() = hasPrivateForwards } -sealed interface ExtendedPublicChat : ExtendedChat, PublicChat { +sealed interface ExtendedPublicChat : ExtendedChat, PublicChat, ExtendedNonBotChat { val description: String val inviteLink: String? @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) @@ -65,11 +74,6 @@ sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat, Ext @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedForumChat : ExtendedSupergroupChat, ForumChat -@Serializable(ExtendedChatSerializer.Companion::class) -sealed interface ExtendedChat : Chat { - val chatPhoto: ChatPhoto? -} - @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedChatWithUsername : UsernameChat, ExtendedChat { val activeUsernames: List