Fix Anonymous Admins: support for is_anonymous flag
MODIFY
CHANGELOG.md
CHANGELOG.md
* `LocationContent#createResend` now can create `LiveLocation`
* Support of `ProximityAlertTriggered`. It is `CommonEvent`
* Property `pollQuestionTextLength` now have maximum up to `300`
+ * Anonymous Admins:
+ * New field `AdministratorChatMember#isAnonymous`
* `API`:
* Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat`
* New extensions `TelegramBot#unpinAllChatMessages`

MODIFY
tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/AdministratorChatMemberImpl.kt
tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/AdministratorChatMemberImpl.kt
@@ -14,5 +14,6 @@ data class AdministratorChatMemberImpl(
override val canRestrictMembers: Boolean,
override val canPinMessages: Boolean,
override val canPromoteMembers: Boolean,
+ override val isAnonymous: Boolean,
override val customTitle: String?
) : AdministratorChatMember

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

MODIFY
tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/RawChatMember.kt
tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/RawChatMember.kt
@@ -40,12 +40,14 @@ internal data class RawChatMember(
private val canSendOtherMessages: Boolean = false,
@SerialName(canAddWebPagePreviewsField)
private val canAddWebPagePreviews: Boolean = false,
+ @SerialName(isAnonymousField)
+ private val isAnonymous: Boolean = false,
@SerialName(customTitleField)
private val customTitle: String? = null
) {
val asChatMember: ChatMember by lazy {
when (status) {
- "creator" -> CreatorChatMember(user, customTitle)
+ "creator" -> CreatorChatMember(user, isAnonymous, customTitle)
"administrator" -> AdministratorChatMemberImpl(
user,
canBeEdited,
@@ -57,6 +59,7 @@ internal data class RawChatMember(
canRestrictMembers,
canPinMessages,
canPromoteMembers,
+ isAnonymous,
customTitle
)
"member" -> MemberChatMember(user)

MODIFY
tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt
tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt
@@ -7,5 +7,6 @@ interface AdministratorChatMember : SpecialRightsChatMember {
val canRemoveMessages: Boolean
val canRestrictMembers: Boolean
val canPromoteMembers: Boolean
+ val isAnonymous: Boolean
val customTitle: String?
}
\ No newline at end of file

Fix #184: Anonymous Admins: support for is_anonymous flag