1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +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.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.JsonObject
@Serializable @Serializable
private data class RawChatInviteLink( private data class RawChatInviteLink(
@ -42,27 +41,6 @@ sealed class ChatInviteLink {
abstract val membersLimit: MembersLimit? 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 @Serializable
data class PrimaryInviteLink( data class PrimaryInviteLink(
@SerialName(inviteLinkField) @SerialName(inviteLinkField)
@ -114,9 +92,6 @@ object ChatInviteLinkSerializer : KSerializer<ChatInviteLink> {
val deserializedRaw = RawChatInviteLink.serializer().deserialize(decoder) val deserializedRaw = RawChatInviteLink.serializer().deserialize(decoder)
return deserializedRaw.run { return deserializedRaw.run {
when { when {
creator is Bot -> BotInviteLink(
inviteLink, creator, isRevoked, expirationDateTime, membersLimit
)
deserializedRaw.isPrimary -> PrimaryInviteLink( deserializedRaw.isPrimary -> PrimaryInviteLink(
inviteLink, creator, isRevoked, expirationDateTime, membersLimit inviteLink, creator, isRevoked, expirationDateTime, membersLimit
) )