From 54cfea9adfb3d6ad4f261539552a3255e0e66c64 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 6 Nov 2020 14:42:30 +0600 Subject: [PATCH] fill changelog --- CHANGELOG.md | 5 +++++ .../kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf0baa7cd7..63731b1d96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,11 @@ * `List#separateForMessage` * `List#separateForCaption` * `List#separateForText` + * Rewritten work with text sources and text parts: + * Now any `Message` type with entities will have full list of entities. That means that parts without any + formatter entities will use `RegularTextSource` + * `MultilevelTextSource#textParts` has been deprecated. Now each `MultilevelTextSource` have its own + `textSources` list * `API`: * Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat` * New extensions `TelegramBot#unpinAllChatMessages` diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt index 9113ee5c18..bf20cd6b82 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt @@ -29,7 +29,7 @@ data class TextPart( fun List.justTextSources() = map { it.source } fun List.makeString() = joinToString("") { it.source } -fun MultilevelTextSource.textParts(offset: Int): List = textSources.toTextParts(offset) +internal fun MultilevelTextSource.textParts(offset: Int): List = textSources.toTextParts(offset) fun List.separateForMessage(limit: IntRange, numberOfParts: Int? = null): List> { if (isEmpty()) { return emptyList()