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
|
||||
|
||||
* Now any administrator object instance have `customTitle` nullable field
|
||||
* Added the new request `SetChatAdministratorCustomTitle` to manage the custom titles of administrators promoted by the
|
||||
bot.
|
||||
* Added the field `slowModeDelay` to the `ExtendedSupergroupChat` objects.
|
||||
|
@ -13,5 +13,6 @@ data class AdministratorChatMemberImpl(
|
||||
override val canInviteUsers: Boolean,
|
||||
override val canRestrictMembers: Boolean,
|
||||
override val canPinMessages: Boolean,
|
||||
override val canPromoteMembers: Boolean
|
||||
override val canPromoteMembers: Boolean,
|
||||
override val customTitle: String?
|
||||
) : 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.User
|
||||
|
||||
data class CreatorChatMember(override val user: User) :
|
||||
AdministratorChatMember {
|
||||
data class CreatorChatMember(
|
||||
override val user: User,
|
||||
override val customTitle: String?
|
||||
) : AdministratorChatMember {
|
||||
override val canBeEdited: Boolean = true
|
||||
override val canChangeInfo: Boolean = true
|
||||
override val canPostMessages: Boolean = true
|
||||
|
@ -39,11 +39,13 @@ internal data class RawChatMember(
|
||||
@SerialName(canSendOtherMessagesField)
|
||||
private val canSendOtherMessages: Boolean = false,
|
||||
@SerialName(canAddWebPagePreviewsField)
|
||||
private val canAddWebPagePreviews: Boolean = false
|
||||
private val canAddWebPagePreviews: Boolean = false,
|
||||
@SerialName(customTitleField)
|
||||
private val customTitle: String? = null
|
||||
) {
|
||||
val asChatMember: ChatMember by lazy {
|
||||
when (status) {
|
||||
"creator" -> CreatorChatMember(user)
|
||||
"creator" -> CreatorChatMember(user, customTitle)
|
||||
"administrator" -> AdministratorChatMemberImpl(
|
||||
user,
|
||||
canBeEdited,
|
||||
@ -54,7 +56,8 @@ internal data class RawChatMember(
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
canPromoteMembers,
|
||||
customTitle
|
||||
)
|
||||
"member" -> MemberChatMember(user)
|
||||
"restricted" -> RestrictedChatMember(
|
||||
|
@ -7,4 +7,5 @@ interface AdministratorChatMember : SpecialRightsChatMember {
|
||||
val canRemoveMessages: Boolean
|
||||
val canRestrictMembers: Boolean
|
||||
val canPromoteMembers: Boolean
|
||||
val customTitle: String?
|
||||
}
|
Loading…
Reference in New Issue
Block a user