From cb3494cb394521f9908c703cfbec9beed9fecbc0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 22 Apr 2023 01:24:55 +0600 Subject: [PATCH] Remove redundant chats folder invite link --- .../dev/inmo/tgbotapi/types/ChatInviteLink.kt | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt index 4fa5e3507c..91a295a843 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt @@ -157,40 +157,6 @@ data class ChatInviteLinkUnlimited( get() = expireDate ?.asDate } -/** - * Base interface for all [ChatInviteLink]s which are NOT [PrimaryInviteLink] - */ -@Serializable(ChatInviteLinkSerializer::class) -sealed interface ChatFolderInviteLink : ChatInviteLink { - override val isPrimary: Boolean - get() = false - - companion object { - const val addListLinkPart = "addlist" - } -} - -/** - * Represent [SecondaryChatInviteLink] which have no any restrictions like [ChatInviteLinkWithJoinRequest] or - * [ChatInviteLinkWithLimitedMembers] - */ -@Serializable -data class ChatFolderInviteLinkUnlimited( - @SerialName(inviteLinkField) - override val inviteLink: String, - @SerialName(creatorField) - override val creator: User, - @SerialName(nameField) - override val name: String? = null, - @SerialName(isRevokedField) - override val isRevoked: Boolean = false, - @SerialName(expireDateField) - private val expireDate: TelegramDate? = null, -) : ChatFolderInviteLink { - override val expirationDateTime: DateTime? - get() = expireDate ?.asDate -} - @RiskFeature object ChatInviteLinkSerializer : KSerializer { override val descriptor: SerialDescriptor @@ -213,9 +179,6 @@ object ChatInviteLinkSerializer : KSerializer { inviteLink, creator, name, membersLimit, isRevoked, expirationDateTime ) } - inviteLink.contains(ChatFolderInviteLink.addListLinkPart) -> ChatFolderInviteLinkUnlimited( - inviteLink, creator, name, isRevoked, expirationDateTime - ) else -> ChatInviteLinkUnlimited( inviteLink, creator, name, isRevoked, expirationDateTime )