diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fb7d16720..04a9c2c6fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ must be regular text * Change signature of `createMarkdownText`: now it will return list of strings * Deprecate old signatures of `createMarkdownText`, `toMarkdownCaption`, `toMarkdownText` +* Add `ResendableContent#createResends` which create adapted list of resends for content +* Add `TextContent` own `createResends` realisation ### 0.8.5 diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt index 7c1bb551b3..005aece25d 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt @@ -10,6 +10,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownText +import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownTexts data class TextContent( val text: String, @@ -29,4 +30,21 @@ data class TextContent( replyToMessageId, replyMarkup ) + + override fun createResends( + chatId: ChatIdentifier, + disableNotification: Boolean, + replyToMessageId: MessageIdentifier?, + replyMarkup: KeyboardMarkup? + ): List> = toMarkdownTexts().map { + SendMessage( + chatId, + it, + MarkdownParseMode, + false, + disableNotification, + replyToMessageId, + replyMarkup + ) + } } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/ResendableContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/ResendableContent.kt index 0ad2ccf49d..2d53a39568 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/ResendableContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/ResendableContent.kt @@ -13,4 +13,11 @@ interface ResendableContent { replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ): Request + + fun createResends( + chatId: ChatIdentifier, + disableNotification: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + replyMarkup: KeyboardMarkup? = null + ): List> = listOf(createResend(chatId, disableNotification, replyToMessageId, replyMarkup)) } \ No newline at end of file