mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
CreatorChatMember -> OwnerChatMember
This commit is contained in:
parent
fde2c79f4c
commit
678f79da04
@ -12,6 +12,7 @@
|
|||||||
* New companion functions:
|
* New companion functions:
|
||||||
* `ReplyForce#Selective`
|
* `ReplyForce#Selective`
|
||||||
* `ReplyForce#NonSelective`
|
* `ReplyForce#NonSelective`
|
||||||
|
* Rename `CreatorChatMember` -> `OwnerChatMember`
|
||||||
* `API`:
|
* `API`:
|
||||||
* For `copyMessage` order of parameters has been changed
|
* For `copyMessage` order of parameters has been changed
|
||||||
* `Utils`:
|
* `Utils`:
|
||||||
|
@ -22,7 +22,7 @@ object ChatMemberSerializer : KSerializer<ChatMember> {
|
|||||||
override fun deserialize(decoder: Decoder): ChatMember {
|
override fun deserialize(decoder: Decoder): ChatMember {
|
||||||
val json = JsonObject.serializer().deserialize(decoder)
|
val json = JsonObject.serializer().deserialize(decoder)
|
||||||
return when (json[statusField] ?.jsonPrimitive ?.content ?: error("Status field of chat member must be specified, but incoming json contains next: $json")) {
|
return when (json[statusField] ?.jsonPrimitive ?.content ?: error("Status field of chat member must be specified, but incoming json contains next: $json")) {
|
||||||
"creator" -> nonstrictJsonFormat.decodeFromJsonElement(CreatorChatMember.serializer(), json)
|
"creator" -> nonstrictJsonFormat.decodeFromJsonElement(OwnerChatMember.serializer(), json)
|
||||||
"administrator" -> nonstrictJsonFormat.decodeFromJsonElement(AdministratorChatMemberImpl.serializer(), json)
|
"administrator" -> nonstrictJsonFormat.decodeFromJsonElement(AdministratorChatMemberImpl.serializer(), json)
|
||||||
"member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMemberImpl.serializer(), json)
|
"member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMemberImpl.serializer(), json)
|
||||||
"restricted" -> nonstrictJsonFormat.decodeFromJsonElement(RestrictedChatMember.serializer(), json)
|
"restricted" -> nonstrictJsonFormat.decodeFromJsonElement(RestrictedChatMember.serializer(), json)
|
||||||
@ -34,7 +34,7 @@ object ChatMemberSerializer : KSerializer<ChatMember> {
|
|||||||
|
|
||||||
override fun serialize(encoder: Encoder, value: ChatMember) {
|
override fun serialize(encoder: Encoder, value: ChatMember) {
|
||||||
when (value) {
|
when (value) {
|
||||||
is CreatorChatMember -> CreatorChatMember.serializer()
|
is OwnerChatMember -> OwnerChatMember.serializer()
|
||||||
is AdministratorChatMemberImpl -> AdministratorChatMemberImpl.serializer()
|
is AdministratorChatMemberImpl -> AdministratorChatMemberImpl.serializer()
|
||||||
is MemberChatMember -> MemberChatMemberImpl.serializer()
|
is MemberChatMember -> MemberChatMemberImpl.serializer()
|
||||||
is RestrictedChatMember -> RestrictedChatMember.serializer()
|
is RestrictedChatMember -> RestrictedChatMember.serializer()
|
||||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.types.chat.User
|
|||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class CreatorChatMember(
|
data class OwnerChatMember(
|
||||||
override val user: User,
|
override val user: User,
|
||||||
@SerialName(isAnonymousField)
|
@SerialName(isAnonymousField)
|
||||||
override val isAnonymous: Boolean = false,
|
override val isAnonymous: Boolean = false,
|
||||||
@ -38,3 +38,6 @@ data class CreatorChatMember(
|
|||||||
@Required
|
@Required
|
||||||
private val type: String = "creator"
|
private val type: String = "creator"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("OwnerChatMember", "dev.inmo.tgbotapi.types.chat.member.OwnerChatMember"))
|
||||||
|
typealias CreatorChatMember = OwnerChatMember
|
@ -1828,13 +1828,13 @@ inline fun InlineQueryResult.requireInlineQueryResultVoiceCommon(): InlineQueryR
|
|||||||
this as InlineQueryResultVoiceCommon
|
this as InlineQueryResultVoiceCommon
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> ChatMember.whenCreatorChatMember(block: (CreatorChatMember) -> T) = asCreatorChatMember() ?.let(block)
|
inline fun <T> ChatMember.whenCreatorChatMember(block: (OwnerChatMember) -> T) = asCreatorChatMember() ?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun ChatMember.asCreatorChatMember(): CreatorChatMember? = this as? CreatorChatMember
|
inline fun ChatMember.asCreatorChatMember(): OwnerChatMember? = this as? OwnerChatMember
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun ChatMember.requireCreatorChatMember(): CreatorChatMember = this as CreatorChatMember
|
inline fun ChatMember.requireCreatorChatMember(): OwnerChatMember = this as OwnerChatMember
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> ChatMember.whenKickedChatMember(block: (KickedChatMember) -> T) = asKickedChatMember() ?.let(block)
|
inline fun <T> ChatMember.whenKickedChatMember(block: (KickedChatMember) -> T) = asKickedChatMember() ?.let(block)
|
||||||
|
Loading…
Reference in New Issue
Block a user