mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-27 20:48:44 +00:00
remove BotInviteChatLink
This commit is contained in:
parent
7414a9b41b
commit
2be342a769
@ -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
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user