1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

TextContent now implements TextedInput

This commit is contained in:
InsanusMokrassar 2020-11-12 16:57:32 +06:00
parent b2fa7fee9d
commit 8764f18ca8
2 changed files with 12 additions and 9 deletions

View File

@ -7,6 +7,9 @@
* `MicroUtils`: `0.3.1` -> `0.3.2`
* `Core`:
* `MultilevelTextSource#textSources` has been safely renamed to `subsources`
* `TextContent#fullEntitiesList` has been deprecated
* Now `TextContent` implements `TextedInput`
* `TextContent#entities` has been deprecated
## 0.30.3

View File

@ -1,7 +1,6 @@
package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
import dev.inmo.tgbotapi.CommonAbstracts.*
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendTextMessage
import dev.inmo.tgbotapi.types.ChatIdentifier
@ -15,13 +14,13 @@ import dev.inmo.tgbotapi.utils.internal.fullListOfSubSource
import dev.inmo.tgbotapi.utils.internal.toMarkdownTexts
data class TextContent(
val text: String,
/**
* Not full list of entities. This list WILL NOT contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
* @see [TextContent.fullEntitiesList]
*/
val entities: List<TextPart> = emptyList()
) : MessageContent {
override val text: String,
override val textEntities: List<TextPart> = emptyList()
) : MessageContent, TextedInput {
@Deprecated("Has been renamed", ReplaceWith("textEntities"))
val entities: List<TextPart>
get() = textEntities
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
@ -83,4 +82,5 @@ data class TextContent(
* Convert its [TextContent.entities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
*/
@Deprecated("Useless due to the fact that currently every message contains full list of sources")
fun TextContent.fullEntitiesList(): TextSourcesList = text.fullListOfSubSource(entities).map { it.source }