mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-29 13:38:43 +00:00
now any administrator object instance have nullable field
This commit is contained in:
parent
b4e4bed622
commit
47428dd6f9
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## 0.21.0 TelegramBotAPI 4.5
|
## 0.21.0 TelegramBotAPI 4.5
|
||||||
|
|
||||||
|
* Now any administrator object instance have `customTitle` nullable field
|
||||||
* Added the new request `SetChatAdministratorCustomTitle` to manage the custom titles of administrators promoted by the
|
* Added the new request `SetChatAdministratorCustomTitle` to manage the custom titles of administrators promoted by the
|
||||||
bot.
|
bot.
|
||||||
* Added the field `slowModeDelay` to the `ExtendedSupergroupChat` objects.
|
* Added the field `slowModeDelay` to the `ExtendedSupergroupChat` objects.
|
||||||
|
@ -13,5 +13,6 @@ data class AdministratorChatMemberImpl(
|
|||||||
override val canInviteUsers: Boolean,
|
override val canInviteUsers: Boolean,
|
||||||
override val canRestrictMembers: Boolean,
|
override val canRestrictMembers: Boolean,
|
||||||
override val canPinMessages: Boolean,
|
override val canPinMessages: Boolean,
|
||||||
override val canPromoteMembers: Boolean
|
override val canPromoteMembers: Boolean,
|
||||||
|
override val customTitle: String?
|
||||||
) : AdministratorChatMember
|
) : AdministratorChatMember
|
||||||
|
@ -3,8 +3,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||||
|
|
||||||
data class CreatorChatMember(override val user: User) :
|
data class CreatorChatMember(
|
||||||
AdministratorChatMember {
|
override val user: User,
|
||||||
|
override val customTitle: String?
|
||||||
|
) : AdministratorChatMember {
|
||||||
override val canBeEdited: Boolean = true
|
override val canBeEdited: Boolean = true
|
||||||
override val canChangeInfo: Boolean = true
|
override val canChangeInfo: Boolean = true
|
||||||
override val canPostMessages: Boolean = true
|
override val canPostMessages: Boolean = true
|
||||||
|
@ -39,11 +39,13 @@ internal data class RawChatMember(
|
|||||||
@SerialName(canSendOtherMessagesField)
|
@SerialName(canSendOtherMessagesField)
|
||||||
private val canSendOtherMessages: Boolean = false,
|
private val canSendOtherMessages: Boolean = false,
|
||||||
@SerialName(canAddWebPagePreviewsField)
|
@SerialName(canAddWebPagePreviewsField)
|
||||||
private val canAddWebPagePreviews: Boolean = false
|
private val canAddWebPagePreviews: Boolean = false,
|
||||||
|
@SerialName(customTitleField)
|
||||||
|
private val customTitle: String? = null
|
||||||
) {
|
) {
|
||||||
val asChatMember: ChatMember by lazy {
|
val asChatMember: ChatMember by lazy {
|
||||||
when (status) {
|
when (status) {
|
||||||
"creator" -> CreatorChatMember(user)
|
"creator" -> CreatorChatMember(user, customTitle)
|
||||||
"administrator" -> AdministratorChatMemberImpl(
|
"administrator" -> AdministratorChatMemberImpl(
|
||||||
user,
|
user,
|
||||||
canBeEdited,
|
canBeEdited,
|
||||||
@ -54,7 +56,8 @@ internal data class RawChatMember(
|
|||||||
canInviteUsers,
|
canInviteUsers,
|
||||||
canRestrictMembers,
|
canRestrictMembers,
|
||||||
canPinMessages,
|
canPinMessages,
|
||||||
canPromoteMembers
|
canPromoteMembers,
|
||||||
|
customTitle
|
||||||
)
|
)
|
||||||
"member" -> MemberChatMember(user)
|
"member" -> MemberChatMember(user)
|
||||||
"restricted" -> RestrictedChatMember(
|
"restricted" -> RestrictedChatMember(
|
||||||
|
@ -7,4 +7,5 @@ interface AdministratorChatMember : SpecialRightsChatMember {
|
|||||||
val canRemoveMessages: Boolean
|
val canRemoveMessages: Boolean
|
||||||
val canRestrictMembers: Boolean
|
val canRestrictMembers: Boolean
|
||||||
val canPromoteMembers: Boolean
|
val canPromoteMembers: Boolean
|
||||||
|
val customTitle: String?
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user