1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

add support of protect_content in forwardMessage

This commit is contained in:
InsanusMokrassar 2022-01-01 20:16:07 +06:00
parent 5c6a430f38
commit 2348434048
2 changed files with 23 additions and 14 deletions

View File

@ -11,40 +11,46 @@ suspend fun TelegramBot.forwardMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messageId: MessageIdentifier, messageId: MessageIdentifier,
disableNotification: Boolean = false disableNotification: Boolean = false,
protectContent: Boolean = false
) = execute( ) = execute(
ForwardMessage(fromChatId, toChatId, messageId, disableNotification) ForwardMessage(fromChatId, toChatId, messageId, disableNotification, protectContent)
) )
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
fromChat: Chat, fromChat: Chat,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messageId: MessageIdentifier, messageId: MessageIdentifier,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification) protectContent: Boolean = false
) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChat: Chat, toChat: Chat,
messageId: MessageIdentifier, messageId: MessageIdentifier,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification) protectContent: Boolean = false
) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
fromChat: Chat, fromChat: Chat,
toChat: Chat, toChat: Chat,
messageId: MessageIdentifier, messageId: MessageIdentifier,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification) protectContent: Boolean = false
) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
message: Message, message: Message,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification) protectContent: Boolean = false
) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
toChat: Chat, toChat: Chat,
message: Message, message: Message,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = forwardMessage(message.chat, toChat, message.messageId, disableNotification) protectContent: Boolean = false
) = forwardMessage(message.chat, toChat, message.messageId, disableNotification, protectContent)

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.requests package dev.inmo.tgbotapi.requests
import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction 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.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
@ -18,8 +19,10 @@ data class ForwardMessage(
@SerialName(messageIdField) @SerialName(messageIdField)
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
val disableNotification: Boolean = false val disableNotification: Boolean = false,
): SimpleRequest<PossiblyForwardedMessage>, MessageAction { @SerialName(protectContentField)
override val protectContent: Boolean = false
): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent {
override val chatId: ChatIdentifier override val chatId: ChatIdentifier
get() = fromChatId get() = fromChatId