diff --git a/CHANGELOG.md b/CHANGELOG.md index 63731b1d96..91a84a9ea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,7 @@ formatter entities will use `RegularTextSource` * `MultilevelTextSource#textParts` has been deprecated. Now each `MultilevelTextSource` have its own `textSources` list + * New dsl for creating of `TextSource` lists * `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/Captioned.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Captioned.kt index 5d55cc4854..81cbcdca86 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Captioned.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Captioned.kt @@ -19,8 +19,16 @@ interface CaptionedInput : Captioned { val captionEntities: List } +/** + * @see CaptionedInput.captionEntities + * @see justTextSources + */ +val CaptionedInput.textSources + get() = captionEntities.justTextSources() + /** * Convert its [CaptionedInput.captionEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource] * with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource] */ +@Deprecated("Currently list of entities already full. This method is redundant") fun CaptionedInput.fullEntitiesList(): TextSourcesList = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/CommonVenueData.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/CommonVenueData.kt index f3361259d1..6a2ac806a7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/CommonVenueData.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/CommonVenueData.kt @@ -1,9 +1,6 @@ package dev.inmo.tgbotapi.CommonAbstracts -import dev.inmo.tgbotapi.types.FoursquareId -import dev.inmo.tgbotapi.types.FoursquareType -import dev.inmo.tgbotapi.types.GooglePlaceId -import dev.inmo.tgbotapi.types.GooglePlaceType +import dev.inmo.tgbotapi.types.* interface CommonVenueData : Titled { override val title: String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Explained.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Explained.kt index 40770b027c..54fcb6b158 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Explained.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Explained.kt @@ -25,8 +25,16 @@ interface ExplainedInput : Explained { val explanationEntities: List } +/** + * @see ExplainedInput.explanationEntities + * @see justTextSources + */ +val ExplainedInput.textSources + get() = explanationEntities.justTextSources() + /** * Convert its [ExplainedInput.explanationEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource] * with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource] */ +@Deprecated("Currently list of entities already full. This method is redundant") fun ExplainedInput.fullEntitiesList(): TextSourcesList = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Texted.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Texted.kt index 9b5ade197b..059575534f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Texted.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Texted.kt @@ -25,8 +25,16 @@ interface TextedInput : Texted { val textEntities: List } +/** + * @see TextedInput.textEntities + * @see justTextSources + */ +val TextedInput.textSources + get() = textEntities.justTextSources() + /** * Convert its [TextedInput.textEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource] * with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource] */ +@Deprecated("Currently list of entities already full. This method is redundant") fun TextedInput.fullEntitiesList(): TextSourcesList = text ?.fullListOfSubSource(textEntities) ?.map { it.source } ?: emptyList()