mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
commit
051210caf5
@ -1,5 +1,12 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 9.2.1
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Ktor`: `2.3.3` -> `2.3.4`
|
||||||
|
* `Core`:
|
||||||
|
* All `ChatMember` inheritors have fixes `status` field
|
||||||
|
|
||||||
## 9.2.0
|
## 9.2.0
|
||||||
|
|
||||||
**Add support of [Telegram Bots API 6.9](https://core.telegram.org/bots/api-changelog#september-22-2023)**
|
**Add support of [Telegram Bots API 6.9](https://core.telegram.org/bots/api-changelog#september-22-2023)**
|
||||||
|
@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=9.2.0
|
library_version=9.2.1
|
||||||
|
@ -8,7 +8,7 @@ javax-activation = "1.1.1"
|
|||||||
|
|
||||||
korlibs = "4.0.3"
|
korlibs = "4.0.3"
|
||||||
uuid = "0.7.1"
|
uuid = "0.7.1"
|
||||||
ktor = "2.3.3"
|
ktor = "2.3.4"
|
||||||
|
|
||||||
ksp = "1.8.22-1.0.11"
|
ksp = "1.8.22-1.0.11"
|
||||||
kotlin-poet = "1.14.2"
|
kotlin-poet = "1.14.2"
|
||||||
|
@ -45,6 +45,5 @@ data class AdministratorChatMemberImpl(
|
|||||||
) : AdministratorChatMember {
|
) : AdministratorChatMember {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
override val status: ChatMember.Status
|
override val status: ChatMember.Status = ChatMember.Status.Administrator
|
||||||
get() = ChatMember.Status.Administrator
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
|||||||
import kotlinx.serialization.DeserializationStrategy
|
import kotlinx.serialization.DeserializationStrategy
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
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
|
||||||
@ -15,8 +16,11 @@ import kotlinx.serialization.json.jsonPrimitive
|
|||||||
|
|
||||||
@Serializable(ChatMemberSerializer::class)
|
@Serializable(ChatMemberSerializer::class)
|
||||||
sealed interface ChatMember : WithUser {
|
sealed interface ChatMember : WithUser {
|
||||||
@Serializable
|
@Serializable(StatusSerializer::class)
|
||||||
enum class Status(val status: String, val deserializationStrategy: DeserializationStrategy<ChatMember>) {
|
enum class Status(
|
||||||
|
val status: String,
|
||||||
|
val deserializationStrategy: DeserializationStrategy<ChatMember>
|
||||||
|
) {
|
||||||
Creator("creator", OwnerChatMember.serializer()),
|
Creator("creator", OwnerChatMember.serializer()),
|
||||||
Administrator("administrator", AdministratorChatMemberImpl.serializer()),
|
Administrator("administrator", AdministratorChatMemberImpl.serializer()),
|
||||||
Member("member", MemberChatMemberImpl.serializer()),
|
Member("member", MemberChatMemberImpl.serializer()),
|
||||||
@ -24,6 +28,23 @@ sealed interface ChatMember : WithUser {
|
|||||||
Left("left", LeftChatMemberImpl.serializer()),
|
Left("left", LeftChatMemberImpl.serializer()),
|
||||||
Kicked("kicked", KickedChatMember.serializer())
|
Kicked("kicked", KickedChatMember.serializer())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object StatusSerializer : KSerializer<Status> {
|
||||||
|
override val descriptor: SerialDescriptor
|
||||||
|
get() = String.serializer().descriptor
|
||||||
|
|
||||||
|
override fun deserialize(decoder: Decoder): Status {
|
||||||
|
val status = decoder.decodeString()
|
||||||
|
return Status.values().first {
|
||||||
|
it.status == status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun serialize(encoder: Encoder, value: Status) {
|
||||||
|
encoder.encodeString(value.status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val status: Status
|
val status: Status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,5 @@ data class KickedChatMember(
|
|||||||
) : BannedChatMember {
|
) : BannedChatMember {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
override val status: ChatMember.Status
|
override val status: ChatMember.Status = ChatMember.Status.Kicked
|
||||||
get() = ChatMember.Status.Kicked
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,5 @@ data class LeftChatMemberImpl(
|
|||||||
) : LeftChatMember {
|
) : LeftChatMember {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
override val status: ChatMember.Status
|
override val status: ChatMember.Status = ChatMember.Status.Left
|
||||||
get() = ChatMember.Status.Left
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,5 @@ data class MemberChatMemberImpl(
|
|||||||
) : MemberChatMember {
|
) : MemberChatMember {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
override val status: ChatMember.Status
|
override val status: ChatMember.Status = ChatMember.Status.Member
|
||||||
get() = ChatMember.Status.Member
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,5 @@ data class OwnerChatMember(
|
|||||||
|
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
override val status: ChatMember.Status
|
override val status: ChatMember.Status = ChatMember.Status.Creator
|
||||||
get() = ChatMember.Status.Creator
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,5 @@ data class RestrictedChatMember(
|
|||||||
) : BannedChatMember, SpecialRightsChatMember, ChatPermissions {
|
) : BannedChatMember, SpecialRightsChatMember, ChatPermissions {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
override val status: ChatMember.Status
|
override val status: ChatMember.Status = ChatMember.Status.Restricted
|
||||||
get() = ChatMember.Status.Restricted
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user