From 2348434048d09d90a2eed3fe96665951ee79b10d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 1 Jan 2022 20:16:07 +0600 Subject: [PATCH] add support of protect_content in forwardMessage --- .../tgbotapi/extensions/api/ForwardMessage.kt | 30 +++++++++++-------- .../inmo/tgbotapi/requests/ForwardMessage.kt | 7 +++-- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessage.kt index c2052f8a8c..ee30e92cd5 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessage.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessage.kt @@ -11,40 +11,46 @@ suspend fun TelegramBot.forwardMessage( fromChatId: ChatIdentifier, toChatId: ChatIdentifier, messageId: MessageIdentifier, - disableNotification: Boolean = false + disableNotification: Boolean = false, + protectContent: Boolean = false ) = execute( - ForwardMessage(fromChatId, toChatId, messageId, disableNotification) + ForwardMessage(fromChatId, toChatId, messageId, disableNotification, protectContent) ) suspend fun TelegramBot.forwardMessage( fromChat: Chat, toChatId: ChatIdentifier, messageId: MessageIdentifier, - disableNotification: Boolean = false -) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification) + disableNotification: Boolean = false, + protectContent: Boolean = false +) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification, protectContent) suspend fun TelegramBot.forwardMessage( fromChatId: ChatIdentifier, toChat: Chat, messageId: MessageIdentifier, - disableNotification: Boolean = false -) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification) + disableNotification: Boolean = false, + protectContent: Boolean = false +) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification, protectContent) suspend fun TelegramBot.forwardMessage( fromChat: Chat, toChat: Chat, messageId: MessageIdentifier, - disableNotification: Boolean = false -) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification) + disableNotification: Boolean = false, + protectContent: Boolean = false +) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification, protectContent) suspend fun TelegramBot.forwardMessage( toChatId: ChatIdentifier, message: Message, - disableNotification: Boolean = false -) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification) + disableNotification: Boolean = false, + protectContent: Boolean = false +) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification, protectContent) suspend fun TelegramBot.forwardMessage( toChat: Chat, message: Message, - disableNotification: Boolean = false -) = forwardMessage(message.chat, toChat, message.messageId, disableNotification) + disableNotification: Boolean = false, + protectContent: Boolean = false +) = forwardMessage(message.chat, toChat, message.messageId, disableNotification, protectContent) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/ForwardMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/ForwardMessage.kt index 5428305ec6..deb9c2dbf3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/ForwardMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/ForwardMessage.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.requests import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction +import dev.inmo.tgbotapi.CommonAbstracts.types.ProtectContent import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage @@ -18,8 +19,10 @@ data class ForwardMessage( @SerialName(messageIdField) override val messageId: MessageIdentifier, @SerialName(disableNotificationField) - val disableNotification: Boolean = false -): SimpleRequest, MessageAction { + val disableNotification: Boolean = false, + @SerialName(protectContentField) + override val protectContent: Boolean = false +): SimpleRequest, MessageAction, ProtectContent { override val chatId: ChatIdentifier get() = fromChatId