1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-18 07:45:27 +00:00

full removing of old redundant "fullEntitiesList"

This commit is contained in:
InsanusMokrassar 2021-01-09 20:52:21 +06:00
parent 9453ec37e7
commit 044fe5eadf
6 changed files with 9 additions and 37 deletions

View File

@ -13,8 +13,7 @@ interface CaptionedOutput : Captioned {
interface CaptionedInput : Captioned {
/**
* Not full list of entities. This list WILL NOT contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
* @see [CaptionedInput.fullEntitiesList]
* Full list of entities. This list WILL contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
*/
val captionEntities: List<TextPart>
}
@ -25,9 +24,3 @@ interface CaptionedInput : Captioned {
*/
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]
*/
internal fun CaptionedInput.fullEntitiesList(): TextSourcesList = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()

View File

@ -20,7 +20,6 @@ interface ExplainedOutput : ParsableExplainedOutput, EntitiesExplainedOutput
interface ExplainedInput : Explained {
/**
* Full list of entities. This list WILL contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
* @see [ExplainedInput.fullEntitiesList]
*/
val explanationEntities: List<TextPart>
}
@ -31,9 +30,3 @@ interface ExplainedInput : Explained {
*/
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]
*/
internal fun ExplainedInput.fullEntitiesList(): TextSourcesList = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList()

View File

@ -22,7 +22,6 @@ interface TextedInput : Texted {
* Here must be full list of entities. This list must contains [TextPart]s with
* [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource] in case if source text contains parts of
* regular text
* @see [CaptionedInput.fullEntitiesList]
*/
val textEntities: List<TextPart>
}
@ -35,9 +34,3 @@ interface TextedInput : Texted {
*/
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]
*/
internal fun TextedInput.fullEntitiesList(): TextSourcesList = text ?.fullListOfSubSource(textEntities) ?.map { it.source } ?: emptyList()

View File

@ -87,7 +87,7 @@ fun Poll.createRequest(
correctOptionId,
isAnonymous,
isClosed,
fullEntitiesList(),
textSources,
scheduledCloseInfo,
disableNotification,
replyToMessageId,

View File

@ -73,9 +73,3 @@ data class TextContent(
)
}
}
/**
* Convert its [TextContent.entities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
*/
internal fun TextContent.fullEntitiesList(): TextSourcesList = text.fullListOfSubSource(textEntities).map { it.source }

View File

@ -4,7 +4,6 @@ import dev.inmo.tgbotapi.CommonAbstracts.*
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.ParseMode.*
import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.content.fullEntitiesList
internal fun createFormattedText(
entities: TextSourcesList,
@ -56,13 +55,13 @@ internal fun TextSourcesList.toMarkdownTexts(): List<String> = createMarkdownTex
this,
textLength.last
)
internal fun TextContent.toMarkdownTexts(): List<String> = fullEntitiesList().toMarkdownTexts()
internal fun TextContent.toMarkdownTexts(): List<String> = textSources.toMarkdownTexts()
internal fun TextSourcesList.toMarkdownExplanations(): List<String> = createMarkdownText(
this,
explanationLimit.last
)
internal fun ExplainedInput.toMarkdownExplanations(): List<String> = fullEntitiesList().toMarkdownTexts()
internal fun ExplainedInput.toMarkdownExplanations(): List<String> = textSources.toMarkdownTexts()
internal fun createMarkdownV2Text(
@ -74,19 +73,19 @@ internal fun TextSourcesList.toMarkdownV2Captions(): List<String> = createMarkdo
this,
captionLength.last
)
internal fun CaptionedInput.toMarkdownV2Captions(): List<String> = fullEntitiesList().toMarkdownV2Captions()
internal fun CaptionedInput.toMarkdownV2Captions(): List<String> = textSources.toMarkdownV2Captions()
internal fun TextSourcesList.toMarkdownV2Texts(): List<String> = createMarkdownV2Text(
this,
textLength.last
)
internal fun TextContent.toMarkdownV2Texts(): List<String> = fullEntitiesList().toMarkdownV2Texts()
internal fun TextContent.toMarkdownV2Texts(): List<String> = textSources.toMarkdownV2Texts()
internal fun TextSourcesList.toMarkdownV2Explanations(): List<String> = createMarkdownV2Text(
this,
explanationLimit.last
)
internal fun ExplainedInput.toMarkdownV2Explanations(): List<String> = fullEntitiesList().toMarkdownV2Texts()
internal fun ExplainedInput.toMarkdownV2Explanations(): List<String> = textSources.toMarkdownV2Texts()
internal fun createHtmlText(
@ -98,12 +97,12 @@ internal fun TextSourcesList.toHtmlCaptions(): List<String> = createHtmlText(
this,
captionLength.last
)
internal fun CaptionedInput.toHtmlCaptions(): List<String> = fullEntitiesList().toHtmlCaptions()
internal fun CaptionedInput.toHtmlCaptions(): List<String> = textSources.toHtmlCaptions()
internal fun TextSourcesList.toHtmlTexts(): List<String> = createHtmlText(
this,
textLength.last
)
internal fun TextContent.toHtmlTexts(): List<String> = fullEntitiesList().toHtmlTexts()
internal fun TextContent.toHtmlTexts(): List<String> = textSources.toHtmlTexts()