1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 00:03:48 +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,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean?
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = execute(
PromoteChatMember(
chatId,
@ -36,7 +37,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages,
canPromoteMembers,
canManageVideoChats,
canManageChat
canManageChat,
canManageTopics
)
)
@ -54,7 +56,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember(
chat.id,
userId,
@ -69,7 +72,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages,
canPromoteMembers,
canManageVideoChats,
canManageChat
canManageChat,
canManageTopics
)
suspend fun TelegramBot.promoteChatMember(
@ -86,7 +90,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember(
chatId,
user.id,
@ -101,7 +106,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages,
canPromoteMembers,
canManageVideoChats,
canManageChat
canManageChat,
canManageTopics
)
suspend fun TelegramBot.promoteChatMember(
@ -118,7 +124,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember(
chat.id,
user.id,
@ -133,5 +140,6 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages,
canPromoteMembers,
canManageVideoChats,
canManageChat
canManageChat,
canManageTopics
)

View File

@ -35,7 +35,9 @@ data class PromoteChatMember(
@SerialName(canManageVideoChatsField)
private val canManageVideoChats: Boolean? = null,
@SerialName(canManageChatField)
private val canManageChat: Boolean? = null
private val canManageChat: Boolean? = null,
@SerialName(canManageTopicsField)
private val canManageTopics: Boolean? = null
) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "promoteChatMember"
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 allowsMultipleAnswersField = "allows_multiple_answers"
const val isAnonymousField = "is_anonymous"
const val canManageTopicsField = "can_manage_topics"
const val captionEntitiesField = "caption_entities"
const val loginUrlField = "login_url"
const val forwardTextField = "forward_text"

View File

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

View File

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

View File

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

View File

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

View File

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