1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00

can_manage_topics support

This commit is contained in:
InsanusMokrassar 2022-11-06 14:18:34 +06:00
parent 1ed620df85
commit c7f372c1e3
8 changed files with 33 additions and 13 deletions

View File

@ -20,7 +20,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null, canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = execute( ) = execute(
PromoteChatMember( PromoteChatMember(
chatId, chatId,
@ -36,7 +37,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
canManageVideoChats, canManageVideoChats,
canManageChat canManageChat,
canManageTopics
) )
) )
@ -54,7 +56,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null, canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chat.id, chat.id,
userId, userId,
@ -69,7 +72,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
canManageVideoChats, canManageVideoChats,
canManageChat canManageChat,
canManageTopics
) )
suspend fun TelegramBot.promoteChatMember( suspend fun TelegramBot.promoteChatMember(
@ -86,7 +90,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null, canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chatId, chatId,
user.id, user.id,
@ -101,7 +106,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
canManageVideoChats, canManageVideoChats,
canManageChat canManageChat,
canManageTopics
) )
suspend fun TelegramBot.promoteChatMember( suspend fun TelegramBot.promoteChatMember(
@ -118,7 +124,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null, canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chat.id, chat.id,
user.id, user.id,
@ -133,5 +140,6 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
canManageVideoChats, canManageVideoChats,
canManageChat canManageChat,
canManageTopics
) )

View File

@ -35,7 +35,9 @@ data class PromoteChatMember(
@SerialName(canManageVideoChatsField) @SerialName(canManageVideoChatsField)
private val canManageVideoChats: Boolean? = null, private val canManageVideoChats: Boolean? = null,
@SerialName(canManageChatField) @SerialName(canManageChatField)
private val canManageChat: Boolean? = null private val canManageChat: Boolean? = null,
@SerialName(canManageTopicsField)
private val canManageTopics: 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

@ -222,6 +222,7 @@ const val totalVoterCountField = "total_voter_count"
const val correctOptionIdField = "correct_option_id" const val correctOptionIdField = "correct_option_id"
const val allowsMultipleAnswersField = "allows_multiple_answers" const val allowsMultipleAnswersField = "allows_multiple_answers"
const val isAnonymousField = "is_anonymous" const val isAnonymousField = "is_anonymous"
const val canManageTopicsField = "can_manage_topics"
const val captionEntitiesField = "caption_entities" const val captionEntitiesField = "caption_entities"
const val loginUrlField = "login_url" const val loginUrlField = "login_url"
const val forwardTextField = "forward_text" const val forwardTextField = "forward_text"

View File

@ -33,7 +33,9 @@ data class AdministratorChatMemberImpl(
@SerialName(isAnonymousField) @SerialName(isAnonymousField)
override val isAnonymous: Boolean = false, override val isAnonymous: Boolean = false,
@SerialName(customTitleField) @SerialName(customTitleField)
override val customTitle: String? = null override val customTitle: String? = null,
@SerialName(canManageTopicsField)
override val canManageTopics: Boolean = false
) : AdministratorChatMember { ) : AdministratorChatMember {
@SerialName(statusField) @SerialName(statusField)
@Required @Required

View File

@ -4,6 +4,7 @@ sealed interface SpecialChatAdministratorRights {
val canChangeInfo: Boolean val canChangeInfo: Boolean
val canInviteUsers: Boolean val canInviteUsers: Boolean
val canPinMessages: Boolean val canPinMessages: Boolean
val canManageTopics: Boolean
} }
sealed interface ChatAdministratorRights : SpecialChatAdministratorRights { sealed interface ChatAdministratorRights : SpecialChatAdministratorRights {

View File

@ -27,5 +27,7 @@ data class ChatAdministratorRightsImpl(
@SerialName(canManageChatField) @SerialName(canManageChatField)
override val canManageChat: Boolean = false, override val canManageChat: Boolean = false,
@SerialName(isAnonymousField) @SerialName(isAnonymousField)
override val isAnonymous: Boolean = false override val isAnonymous: Boolean = false,
@SerialName(canManageTopicsField)
override val canManageTopics: Boolean = false
) : ChatAdministratorRights ) : ChatAdministratorRights

View File

@ -33,7 +33,9 @@ data class OwnerChatMember(
@Transient @Transient
override val canManageVideoChats: Boolean = true override val canManageVideoChats: Boolean = true
@Transient @Transient
override val canManageChat: Boolean = true override val canManageChat: Boolean = true,
@Transient
override val canManageTopics: Boolean = true
@SerialName(statusField) @SerialName(statusField)
@Required @Required
private val type: String = "creator" private val type: String = "creator"

View File

@ -27,7 +27,9 @@ data class RestrictedChatMember(
@SerialName(canInviteUsersField) @SerialName(canInviteUsersField)
override val canInviteUsers: Boolean = false, override val canInviteUsers: Boolean = false,
@SerialName(canPinMessagesField) @SerialName(canPinMessagesField)
override val canPinMessages: Boolean = false override val canPinMessages: Boolean = false,
@SerialName(canManageTopicsField)
override val canManageTopics: Boolean = false
) : BannedChatMember, SpecialRightsChatMember { ) : BannedChatMember, SpecialRightsChatMember {
@SerialName(statusField) @SerialName(statusField)
@Required @Required