Td Api Formatted Text - OTR/Kotlin-Telegram-Client GitHub Wiki

Class TdApi.FormattedText

Description

Represents a formatted text. It can contain plain and formatted text.

Properties

  • text : String - a plain text without formatting.
  • entities : Array<TdApi.TextEntity> - a list of special entities that appear in the text. For example, usernames, URLs, bot commands, etc.

Example

import it.tdlight.jni.TdApi

fun someFunThatGetsMessageText(messageText: TdApi.MessageText) {
    // A text with some entities.
    val formattedText: TdApi.FormattedText = messageText.text
    // Entities contained in the text.
    // Entities can be nested, but must not mutually intersect with each other.
    // Pre, Code and PreCode entities can't contain other entities.
    // Bold, Italic, Underline and Strikethrough entities can contain
    // and to be contained in all other entities.
    // All other entities can't contain each other.
    val entities: Array<TdApi.TextEntity> = formattedText.entities
    val plainText: String = formattedText.text
}

Reference

Generated docs for TdApi.FormattedText