1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-30 14:08:44 +00:00

include canManageChat

This commit is contained in:
InsanusMokrassar 2021-03-09 19:26:30 +06:00
parent 80200d78ef
commit 3c5abac669
6 changed files with 25 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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