From c66d1e8665ca54506d6aeeb9a1b77b1469034b10 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 9 Mar 2021 19:33:05 +0600 Subject: [PATCH] include revokeMessages in kickChatMember --- .../requests/chat/members/KickChatMember.kt | 4 +++- .../kotlin/dev/inmo/tgbotapi/types/Common.kt | 1 + .../api/chat/members/KickChatMember.kt | 20 +++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/KickChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/KickChatMember.kt index 6074de0d79..58d62c3359 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/KickChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/KickChatMember.kt @@ -13,7 +13,9 @@ data class KickChatMember( @SerialName(userIdField) override val userId: UserId, @SerialName(untilDateField) - override val untilDate: TelegramDate? = null + override val untilDate: TelegramDate? = null, + @SerialName(revokeMessagesField) + val revokeMessages: Boolean? = null ) : ChatMemberRequest, UntilDate { override fun method(): String = "kickChatMember" override val resultDeserializer: DeserializationStrategy diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index 50a9dacdc3..8eaef26cfb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -162,6 +162,7 @@ const val optionIdsField = "option_ids" const val ipAddressField = "ip_address" const val linkedChatIdField = "linked_chat_id" const val horizontalAccuracyField = "horizontal_accuracy" +const val revokeMessagesField = "revoke_messages" const val requestContactField = "request_contact" const val requestLocationField = "request_location" diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/members/KickChatMember.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/members/KickChatMember.kt index 4fb0049d5c..f924443d8b 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/members/KickChatMember.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/members/KickChatMember.kt @@ -8,23 +8,27 @@ import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat suspend fun TelegramBot.kickChatMember( chatId: ChatIdentifier, userId: UserId, - untilDate: TelegramDate? = null -) = execute(KickChatMember(chatId, userId, untilDate)) + untilDate: TelegramDate? = null, + revokeMessages: Boolean? = null +) = execute(KickChatMember(chatId, userId, untilDate, revokeMessages)) suspend fun TelegramBot.kickChatMember( chat: PublicChat, userId: UserId, - untilDate: TelegramDate? = null -) = kickChatMember(chat.id, userId, untilDate) + untilDate: TelegramDate? = null, + revokeMessages: Boolean? = null +) = kickChatMember(chat.id, userId, untilDate, revokeMessages) suspend fun TelegramBot.kickChatMember( chatId: ChatId, user: User, - untilDate: TelegramDate? = null -) = kickChatMember(chatId, user.id, untilDate) + untilDate: TelegramDate? = null, + revokeMessages: Boolean? = null +) = kickChatMember(chatId, user.id, untilDate, revokeMessages) suspend fun TelegramBot.kickChatMember( chat: PublicChat, user: User, - untilDate: TelegramDate? = null -) = kickChatMember(chat.id, user.id, untilDate) + untilDate: TelegramDate? = null, + revokeMessages: Boolean? = null +) = kickChatMember(chat.id, user.id, untilDate, revokeMessages)