mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
chat members fields and restrict chat member request updates
This commit is contained in:
parent
6310dceacf
commit
8fbda09d24
@ -17,6 +17,9 @@ Changes according to [July 29, 2019 Telegram Bot API update](https://core.telegr
|
||||
* `Sticker` and `StickerSet` now have field `isAnimated`
|
||||
* `ChatPermissions` object was added, `GroupChat` interface got `permissions` field, request `SetChatPermissions` was added
|
||||
* `GroupChat` object now have no field `allMembersAreAdmins`
|
||||
* `SpecialRightsChatMember` was added for administrators and restricted members rights union, chat members abstractions
|
||||
was replaced into `abstracts` package and available permissions was updated
|
||||
* `RestrictChatMember` request now accept `permissions` object instead of separated permissions
|
||||
|
||||
## 0.16.0 Bot API 4.3
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@ -14,14 +15,8 @@ data class RestrictChatMember(
|
||||
override val userId: UserId,
|
||||
@SerialName(untilDateField)
|
||||
override val untilDate: TelegramDate? = null,
|
||||
@SerialName(canSendMessagesField)
|
||||
private val canSendMessages: Boolean? = null,
|
||||
@SerialName(canSendMediaMessagesField)
|
||||
private val canSendMediaMessages: Boolean? = null,
|
||||
@SerialName(canSendOtherMessagesField)
|
||||
private val canSendOtherMessages: Boolean? = null,
|
||||
@SerialName(canAddWebPagePreviewsField)
|
||||
private val canAddWebPagePreviews: Boolean? = null
|
||||
@SerialName(permissionsField)
|
||||
val permissions: ChatPermissions
|
||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||
override fun method(): String = "restrictChatMember"
|
||||
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 AdministratorChatMemberImpl(
|
||||
|
@ -1,8 +1,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) :
|
||||
AdministratorChatMember {
|
||||
override val canBeEdited: Boolean = true
|
||||
override val canChangeInfo: Boolean = true
|
||||
override val canPostMessages: Boolean = true
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.BannedChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.TelegramDate
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||
|
||||
data class LeftChatMember(override val user: User) : ChatMember
|
||||
data class LeftChatMember(override val user: User) :
|
||||
ChatMember
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||
|
||||
data class MemberChatMember(override val user: User) : ChatMember
|
||||
data class MemberChatMember(override val user: User) :
|
||||
ChatMember
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
@ -32,6 +33,8 @@ data class RawChatMember(
|
||||
private val canSendMessages: Boolean = false,
|
||||
@SerialName(canSendMediaMessagesField)
|
||||
private val canSendMediaMessages: Boolean = false,
|
||||
@SerialName(canSendPollsField)
|
||||
private val canSendPolls: Boolean = false,
|
||||
@SerialName(canSendOtherMessagesField)
|
||||
private val canSendOtherMessages: Boolean = false,
|
||||
@SerialName(canAddWebPagePreviewsField)
|
||||
@ -60,8 +63,12 @@ data class RawChatMember(
|
||||
isMember,
|
||||
canSendMessages,
|
||||
canSendMediaMessages,
|
||||
canSendPolls,
|
||||
canSendOtherMessages,
|
||||
canAddWebPagePreviews
|
||||
canAddWebPagePreviews,
|
||||
canChangeInfo,
|
||||
canInviteUsers,
|
||||
canPinMessages
|
||||
)
|
||||
"left" -> LeftChatMember(user)
|
||||
"kicked" -> KickedChatMember(
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.BannedChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.SpecialRightsChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.TelegramDate
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||
|
||||
@ -9,6 +11,10 @@ data class RestrictedChatMember(
|
||||
val isMember: Boolean,
|
||||
val canSendMessages: Boolean,
|
||||
val canSendMediaMessages: Boolean,
|
||||
val canSendPolls: Boolean,
|
||||
val canSendOtherMessages: Boolean,
|
||||
val canAddWebpagePreviews: Boolean
|
||||
) : BannedChatMember
|
||||
val canAddWebpagePreviews: Boolean,
|
||||
override val canChangeInfo: Boolean,
|
||||
override val canInviteUsers: Boolean,
|
||||
override val canPinMessages: Boolean
|
||||
) : BannedChatMember, SpecialRightsChatMember
|
@ -1,13 +1,10 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts
|
||||
|
||||
interface AdministratorChatMember : ChatMember {
|
||||
interface AdministratorChatMember : SpecialRightsChatMember {
|
||||
val canBeEdited: Boolean
|
||||
val canChangeInfo: Boolean
|
||||
val canPostMessages: Boolean
|
||||
val canEditMessages: Boolean
|
||||
val canRemoveMessages: Boolean
|
||||
val canInviteUsers: Boolean
|
||||
val canRestrictMembers: Boolean
|
||||
val canPinMessages: Boolean
|
||||
val canPromoteMembers: Boolean
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||
|
@ -0,0 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts
|
||||
|
||||
interface SpecialRightsChatMember : ChatMember {
|
||||
val canChangeInfo: Boolean
|
||||
val canInviteUsers: Boolean
|
||||
val canPinMessages: Boolean
|
||||
}
|
Loading…
Reference in New Issue
Block a user