1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

Fix #184: Anonymous Admins: support for is_anonymous flag

This commit is contained in:
madhead 2020-11-05 01:56:36 +03:00
parent 53b8cc4625
commit 0a73dfb799
No known key found for this signature in database
GPG Key ID: 66017D6A7E85EBE6
5 changed files with 9 additions and 1 deletions

View File

@ -41,6 +41,8 @@
* `LocationContent#createResend` now can create `LiveLocation` * `LocationContent#createResend` now can create `LiveLocation`
* Support of `ProximityAlertTriggered`. It is `CommonEvent` * Support of `ProximityAlertTriggered`. It is `CommonEvent`
* Property `pollQuestionTextLength` now have maximum up to `300` * Property `pollQuestionTextLength` now have maximum up to `300`
* Anonymous Admins:
* New field `AdministratorChatMember#isAnonymous`
* `API`: * `API`:
* Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat` * Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat`
* New extensions `TelegramBot#unpinAllChatMessages` * New extensions `TelegramBot#unpinAllChatMessages`

View File

@ -14,5 +14,6 @@ data class AdministratorChatMemberImpl(
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 isAnonymous: Boolean,
override val customTitle: String? override val customTitle: String?
) : AdministratorChatMember ) : AdministratorChatMember

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.types.User
data class CreatorChatMember( data class CreatorChatMember(
override val user: User, override val user: User,
override val isAnonymous: Boolean,
override val customTitle: String? override val customTitle: String?
) : AdministratorChatMember { ) : AdministratorChatMember {
override val canBeEdited: Boolean = true override val canBeEdited: Boolean = true

View File

@ -40,12 +40,14 @@ internal data class RawChatMember(
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(isAnonymousField)
private val isAnonymous: Boolean = false,
@SerialName(customTitleField) @SerialName(customTitleField)
private val customTitle: String? = null private val customTitle: String? = null
) { ) {
val asChatMember: ChatMember by lazy { val asChatMember: ChatMember by lazy {
when (status) { when (status) {
"creator" -> CreatorChatMember(user, customTitle) "creator" -> CreatorChatMember(user, isAnonymous, customTitle)
"administrator" -> AdministratorChatMemberImpl( "administrator" -> AdministratorChatMemberImpl(
user, user,
canBeEdited, canBeEdited,
@ -57,6 +59,7 @@ internal data class RawChatMember(
canRestrictMembers, canRestrictMembers,
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
isAnonymous,
customTitle customTitle
) )
"member" -> MemberChatMember(user) "member" -> MemberChatMember(user)

View File

@ -7,5 +7,6 @@ interface AdministratorChatMember : SpecialRightsChatMember {
val canRemoveMessages: Boolean val canRemoveMessages: Boolean
val canRestrictMembers: Boolean val canRestrictMembers: Boolean
val canPromoteMembers: Boolean val canPromoteMembers: Boolean
val isAnonymous: Boolean
val customTitle: String? val customTitle: String?
} }