From 049a8a32632b21f09c846ccf2bacc029e89a5592 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 11 Jul 2022 00:26:57 +0600 Subject: [PATCH] copy message order of parameters changed --- CHANGELOG.md | 5 + .../extensions/api/send/CopyMessage.kt | 119 +++++++----- .../extensions/api/send/OldCopyMessage.kt | 178 ++++++++++++++++++ .../tgbotapi/requests/send/CopyMessage.kt | 73 ++++++- 4 files changed, 322 insertions(+), 53 deletions(-) create mode 100644 tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/OldCopyMessage.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 7822ffd96e..8f49c340c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## 2.2.0 +* `Core`: + * For `CopyMessage` order of parameters has been changed +* `API`: + * For `copyMessage` order of parameters has been changed + ## 2.1.3 * `Versions`: diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/CopyMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/CopyMessage.kt index 9048c4e77f..3ddc68161e 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/CopyMessage.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/CopyMessage.kt @@ -16,8 +16,8 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message */ suspend inline fun TelegramBot.copyMessage( fromChatId: ChatIdentifier, - toChatId: ChatIdentifier, messageId: MessageIdentifier, + toChatId: ChatIdentifier, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, @@ -26,7 +26,18 @@ suspend inline fun TelegramBot.copyMessage( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = execute( - CopyMessage(fromChatId, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + CopyMessage( + fromChatId, + messageId, + toChatId, + text, + parseMode, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup + ) ) /** @@ -35,8 +46,8 @@ suspend inline fun TelegramBot.copyMessage( */ suspend inline fun TelegramBot.copyMessage( fromChat: Chat, - toChatId: ChatIdentifier, messageId: MessageIdentifier, + toChatId: ChatIdentifier, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, @@ -44,7 +55,7 @@ suspend inline fun TelegramBot.copyMessage( replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -52,8 +63,8 @@ suspend inline fun TelegramBot.copyMessage( */ suspend inline fun TelegramBot.copyMessage( fromChatId: ChatIdentifier, - toChat: Chat, messageId: MessageIdentifier, + toChat: Chat, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, @@ -61,7 +72,7 @@ suspend inline fun TelegramBot.copyMessage( replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -69,40 +80,8 @@ suspend inline fun TelegramBot.copyMessage( */ suspend inline fun TelegramBot.copyMessage( fromChat: Chat, - toChat: Chat, messageId: MessageIdentifier, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - protectContent: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) - -/** - * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or - * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param - */ -suspend inline fun TelegramBot.copyMessage( - toChatId: ChatIdentifier, - message: Message, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - protectContent: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = copyMessage(message.chat, toChatId, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) - -/** - * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or - * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param - */ -suspend inline fun TelegramBot.copyMessage( toChat: Chat, - message: Message, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, @@ -110,7 +89,7 @@ suspend inline fun TelegramBot.copyMessage( replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = copyMessage(message.chat, toChat, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** @@ -119,8 +98,8 @@ suspend inline fun TelegramBot.copyMessage( */ suspend inline fun TelegramBot.copyMessage( fromChatId: ChatIdentifier, - toChatId: ChatIdentifier, messageId: MessageIdentifier, + toChatId: ChatIdentifier, entities: TextSourcesList, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -128,7 +107,17 @@ suspend inline fun TelegramBot.copyMessage( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = execute( - CopyMessage(fromChatId, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + CopyMessage( + fromChatId, + messageId, + toChatId, + entities, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup + ) ) /** @@ -137,15 +126,15 @@ suspend inline fun TelegramBot.copyMessage( */ suspend inline fun TelegramBot.copyMessage( fromChat: Chat, - toChatId: ChatIdentifier, messageId: MessageIdentifier, + toChatId: ChatIdentifier, entities: TextSourcesList, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = copyMessage(fromChat.id, messageId, toChatId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -153,15 +142,15 @@ suspend inline fun TelegramBot.copyMessage( */ suspend inline fun TelegramBot.copyMessage( fromChatId: ChatIdentifier, - toChat: Chat, messageId: MessageIdentifier, + toChat: Chat, entities: TextSourcesList, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = copyMessage(fromChatId, messageId, toChat.id, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -169,15 +158,47 @@ suspend inline fun TelegramBot.copyMessage( */ suspend inline fun TelegramBot.copyMessage( fromChat: Chat, - toChat: Chat, messageId: MessageIdentifier, + toChat: Chat, entities: TextSourcesList, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = copyMessage(fromChat.id, messageId, toChat.id, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +suspend inline fun TelegramBot.copyMessage( + toChatId: ChatIdentifier, + message: Message, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +suspend inline fun TelegramBot.copyMessage( + toChat: Chat, + message: Message, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -192,7 +213,7 @@ suspend inline fun TelegramBot.copyMessage( replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = copyMessage(message.chat, toChatId, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = copyMessage(message.chat, message.messageId, toChatId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -207,4 +228,4 @@ suspend inline fun TelegramBot.copyMessage( replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = copyMessage(message.chat, toChat, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = copyMessage(message.chat, message.messageId, toChat, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/OldCopyMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/OldCopyMessage.kt new file mode 100644 index 0000000000..217137aa5f --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/OldCopyMessage.kt @@ -0,0 +1,178 @@ +package dev.inmo.tgbotapi.extensions.api.send + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.send.CopyMessage +import dev.inmo.tgbotapi.requests.send.OrderChangingDeprecationWarn +import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList +import dev.inmo.tgbotapi.types.MessageIdentifier +import dev.inmo.tgbotapi.types.message.ParseMode +import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup +import dev.inmo.tgbotapi.types.chat.Chat +import dev.inmo.tgbotapi.types.message.abstracts.Message + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +@Deprecated(OrderChangingDeprecationWarn) +suspend inline fun TelegramBot.copyMessage( + fromChatId: ChatIdentifier, + toChatId: ChatIdentifier, + messageId: MessageIdentifier, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = execute( + CopyMessage( + fromChatId, + messageId, + toChatId, + text, + parseMode, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup + ) +) + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +@Deprecated(OrderChangingDeprecationWarn) +suspend inline fun TelegramBot.copyMessage( + fromChat: Chat, + toChatId: ChatIdentifier, + messageId: MessageIdentifier, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +@Deprecated(OrderChangingDeprecationWarn) +suspend inline fun TelegramBot.copyMessage( + fromChatId: ChatIdentifier, + toChat: Chat, + messageId: MessageIdentifier, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +@Deprecated(OrderChangingDeprecationWarn) +suspend inline fun TelegramBot.copyMessage( + fromChat: Chat, + toChat: Chat, + messageId: MessageIdentifier, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +@Deprecated(OrderChangingDeprecationWarn) +suspend inline fun TelegramBot.copyMessage( + fromChatId: ChatIdentifier, + toChatId: ChatIdentifier, + messageId: MessageIdentifier, + entities: TextSourcesList, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = execute( + CopyMessage( + fromChatId, + messageId, + toChatId, + entities, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup + ) +) + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +@Deprecated(OrderChangingDeprecationWarn) +suspend inline fun TelegramBot.copyMessage( + fromChat: Chat, + toChatId: ChatIdentifier, + messageId: MessageIdentifier, + entities: TextSourcesList, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +@Deprecated(OrderChangingDeprecationWarn) +suspend inline fun TelegramBot.copyMessage( + fromChatId: ChatIdentifier, + toChat: Chat, + messageId: MessageIdentifier, + entities: TextSourcesList, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) + +/** + * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or + * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param + */ +@Deprecated(OrderChangingDeprecationWarn) +suspend inline fun TelegramBot.copyMessage( + fromChat: Chat, + toChat: Chat, + messageId: MessageIdentifier, + entities: TextSourcesList, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt index bfa673d478..491130cbfe 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt @@ -16,6 +16,9 @@ import dev.inmo.tgbotapi.types.message.toRawMessageEntities import dev.inmo.tgbotapi.utils.extensions.makeString import kotlinx.serialization.* +const val OrderChangingDeprecationWarn = "The order of parameters in this factory will be changed soon. To avoid unexpected behaviour, swap message id and target chat id parameters" + +@Deprecated(OrderChangingDeprecationWarn) fun CopyMessage( fromChatId: ChatIdentifier, toChatId: ChatIdentifier, @@ -27,8 +30,21 @@ fun CopyMessage( replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = CopyMessage( + toChatId, + fromChatId, + messageId, + text, + parseMode, + null, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup +) +@Deprecated(OrderChangingDeprecationWarn) fun CopyMessage( fromChatId: ChatIdentifier, toChatId: ChatIdentifier, @@ -40,8 +56,57 @@ fun CopyMessage( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = CopyMessage( - fromChatId, toChatId, + fromChatId, + messageId, + entities.makeString(), + null, + entities.toRawMessageEntities(), + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup +) + +fun CopyMessage( + fromChatId: ChatIdentifier, + messageId: MessageIdentifier, + toChatId: ChatIdentifier, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = CopyMessage( + toChatId, + fromChatId, + messageId, + text, + parseMode, + null, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup +) + +fun CopyMessage( + fromChatId: ChatIdentifier, + messageId: MessageIdentifier, + toChatId: ChatIdentifier, + entities: List, + disableNotification: Boolean = false, + protectContent: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = CopyMessage( + toChatId, + fromChatId, messageId, entities.makeString(), null, @@ -55,10 +120,10 @@ fun CopyMessage( @Serializable data class CopyMessage internal constructor( - @SerialName(fromChatIdField) - val fromChatId: ChatIdentifier, @SerialName(chatIdField) val toChatId: ChatIdentifier, + @SerialName(fromChatIdField) + val fromChatId: ChatIdentifier, @SerialName(messageIdField) override val messageId: MessageIdentifier, @SerialName(captionField)