1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

Remove redundant chats folder invite link

This commit is contained in:
InsanusMokrassar 2023-04-22 01:24:55 +06:00 committed by GitHub
parent ce81be9dcb
commit cb3494cb39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,40 +157,6 @@ data class ChatInviteLinkUnlimited(
get() = expireDate ?.asDate 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 @RiskFeature
object ChatInviteLinkSerializer : KSerializer<ChatInviteLink> { object ChatInviteLinkSerializer : KSerializer<ChatInviteLink> {
override val descriptor: SerialDescriptor override val descriptor: SerialDescriptor
@ -213,9 +179,6 @@ object ChatInviteLinkSerializer : KSerializer<ChatInviteLink> {
inviteLink, creator, name, membersLimit, isRevoked, expirationDateTime inviteLink, creator, name, membersLimit, isRevoked, expirationDateTime
) )
} }
inviteLink.contains(ChatFolderInviteLink.addListLinkPart) -> ChatFolderInviteLinkUnlimited(
inviteLink, creator, name, isRevoked, expirationDateTime
)
else -> ChatInviteLinkUnlimited( else -> ChatInviteLinkUnlimited(
inviteLink, creator, name, isRevoked, expirationDateTime inviteLink, creator, name, isRevoked, expirationDateTime
) )