1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

include canManageChat

This commit is contained in:
InsanusMokrassar 2021-03-09 19:26:30 +06:00
parent 7639b15dc6
commit 53524abcbb
6 changed files with 25 additions and 9 deletions

View File

@ -33,7 +33,9 @@ data class PromoteChatMember(
@SerialName(canPromoteMembersField)
private val canPromoteMembers: Boolean? = null,
@SerialName(canManageVoiceChatsField)
private val canManageVoiceChats: Boolean? = null
private val canManageVoiceChats: Boolean? = null,
@SerialName(canManageChatField)
private val canManageChat: Boolean? = null
) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "promoteChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean>

View File

@ -28,6 +28,8 @@ data class AdministratorChatMemberImpl(
override val canPromoteMembers: Boolean = false,
@SerialName(canManageVoiceChatsField)
override val canManageVoiceChats: Boolean = false,
@SerialName(canManageChatField)
override val canManageChat: Boolean = false,
@SerialName(isAnonymousField)
override val isAnonymous: Boolean = false,
@SerialName(customTitleField)

View File

@ -32,6 +32,8 @@ data class CreatorChatMember(
override val canPromoteMembers: Boolean = true
@Transient
override val canManageVoiceChats: Boolean = true
@Transient
override val canManageChat: Boolean = true
@SerialName(statusField)
@Required
private val type: String = "creator"

View File

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

View File

@ -240,6 +240,7 @@ const val canRestrictMembersField = "can_restrict_members"
const val canPinMessagesField = "can_pin_messages"
const val canPromoteMembersField = "can_promote_members"
const val canManageVoiceChatsField = "can_manage_voice_chats"
const val canManageChatField = "can_manage_chat"
const val pngStickerField = "png_sticker"
const val tgsStickerField = "tgs_sticker"

View File

@ -18,7 +18,8 @@ suspend fun TelegramBot.promoteChatMember(
canRestrictMembers: Boolean? = null,
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVoiceChats: Boolean? = null
canManageVoiceChats: Boolean? = null,
canManageChat: Boolean?
) = execute(
PromoteChatMember(
chatId,
@ -33,7 +34,8 @@ suspend fun TelegramBot.promoteChatMember(
canRestrictMembers,
canPinMessages,
canPromoteMembers,
canManageVoiceChats
canManageVoiceChats,
canManageChat
)
)
@ -50,7 +52,8 @@ suspend fun TelegramBot.promoteChatMember(
canRestrictMembers: Boolean? = null,
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVoiceChats: Boolean?
canManageVoiceChats: Boolean? = null,
canManageChat: Boolean? = null
) = promoteChatMember(
chat.id,
userId,
@ -64,7 +67,8 @@ suspend fun TelegramBot.promoteChatMember(
canRestrictMembers,
canPinMessages,
canPromoteMembers,
canManageVoiceChats
canManageVoiceChats,
canManageChat
)
suspend fun TelegramBot.promoteChatMember(
@ -80,7 +84,8 @@ suspend fun TelegramBot.promoteChatMember(
canRestrictMembers: Boolean? = null,
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVoiceChats: Boolean?
canManageVoiceChats: Boolean? = null,
canManageChat: Boolean? = null
) = promoteChatMember(
chatId,
user.id,
@ -94,7 +99,8 @@ suspend fun TelegramBot.promoteChatMember(
canRestrictMembers,
canPinMessages,
canPromoteMembers,
canManageVoiceChats
canManageVoiceChats,
canManageChat
)
suspend fun TelegramBot.promoteChatMember(
@ -110,7 +116,8 @@ suspend fun TelegramBot.promoteChatMember(
canRestrictMembers: Boolean? = null,
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVoiceChats: Boolean?
canManageVoiceChats: Boolean? = null,
canManageChat: Boolean? = null
) = promoteChatMember(
chat.id,
user.id,
@ -124,5 +131,6 @@ suspend fun TelegramBot.promoteChatMember(
canRestrictMembers,
canPinMessages,
canPromoteMembers,
canManageVoiceChats
canManageVoiceChats,
canManageChat
)