1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +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` * `MicroUtils`: `0.3.1` -> `0.3.2`
* `Core`: * `Core`:
* `MultilevelTextSource#textSources` has been safely renamed to `subsources` * `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 ## 0.30.3

View File

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