TextEntity
A MessageText flattened the way the Bot API wants it: plain text plus ranges over it.
Here rather than in a transport because the arithmetic is the risky part and it is the same arithmetic for everyone. :telegram sends these almost verbatim; :ktg does not need them, because ktgbotapi flattens its own TextSource list — but the offsets can be tested in :core, on the JVM and on native, without either client library present.
Offsets are in UTF-16 code units, which is what Telegram counts and what Kotlin's String already indexes in. An emoji outside the BMP is two units, and a length taken in characters would put every entity after it in the wrong place — a bug that only shows up in messages that contain one.
Constructors
Properties
Set for TextEntityType.Pre when the block named a language.
Set for TextEntityType.TextLink and nothing else.