1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-27 02:57:13 +00:00

remove BotInviteChatLink

This commit is contained in:
InsanusMokrassar 2021-03-11 16:36:01 +06:00
parent aba62ba930
commit 9ad5bfbc57

View File

@ -5,7 +5,6 @@ import kotlinx.serialization.*
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.JsonObject
@Serializable
private data class RawChatInviteLink(
@ -42,27 +41,6 @@ sealed class ChatInviteLink {
abstract val membersLimit: MembersLimit?
}
@Serializable
data class BotInviteLink(
@SerialName(inviteLinkField)
override val inviteLink: String,
@SerialName(creatorField)
override val creator: Bot,
@SerialName(isRevokedField)
override val isRevoked: Boolean = false,
@SerialName(expireDateField)
private val expireDate: UnixTimeStamp? = null,
@SerialName(memberLimitField)
override val membersLimit: MembersLimit? = null
) : ChatInviteLink() {
override val isPrimary: Boolean
get() = false
override val expirationDateTime: DateTime?
get() {
return DateTime(expireDate ?.seconds ?.milliseconds ?: return null)
}
}
@Serializable
data class PrimaryInviteLink(
@SerialName(inviteLinkField)
@ -114,9 +92,6 @@ object ChatInviteLinkSerializer : KSerializer<ChatInviteLink> {
val deserializedRaw = RawChatInviteLink.serializer().deserialize(decoder)
return deserializedRaw.run {
when {
creator is Bot -> BotInviteLink(
inviteLink, creator, isRevoked, expirationDateTime, membersLimit
)
deserializedRaw.isPrimary -> PrimaryInviteLink(
inviteLink, creator, isRevoked, expirationDateTime, membersLimit
)