MessageTextBuilder

Builds a MessageText.

One builder, in :core, used by both transports. It replaces a TelegramTextBuilder that was duplicated verbatim in :ktg and :telegram — the copy's own comment apologised for itself and asked the next person to keep the two in sync, which is a job nothing checked.

text, bold, br, br2, row and list are the ones the old builder had and behave as they did, so a call site that only used those reads the same; the rest is what legacy Markdown could not express.

Nothing here escapes anything, because nothing downstream parses the text. A name with _, *, [ and a backtick in it goes through text and arrives exactly as typed.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
Link copied to clipboard
fun bold(block: MessageTextBuilder.() -> Unit)
fun bold(value: String)
Link copied to clipboard
fun br()
Link copied to clipboard
fun br2()
Link copied to clipboard
Link copied to clipboard
fun code(value: String)

Inline monospace. Does not nest — see TextPiece.Code.

Link copied to clipboard
fun codeBlock(value: String, language: String? = null)

A monospace block; language only tells the client's highlighter what to do.

Link copied to clipboard

A quote the client shows collapsed. Long output belongs here rather than in the message body.

Link copied to clipboard
fun italic(block: MessageTextBuilder.() -> Unit)
fun italic(value: String)
Link copied to clipboard
fun link(url: String, block: MessageTextBuilder.() -> Unit)
fun link(url: String, value: String)
Link copied to clipboard
fun <T> list(items: List<T>, block: MessageTextBuilder.(T) -> Unit)

Each item rendered by block, separated by a blank line — the old builder's behaviour.

Link copied to clipboard
fun row(block: MessageTextBuilder.() -> Unit)

The block's content on its own line, with a newline before it if one is not already there.

Link copied to clipboard
fun spoiler(block: MessageTextBuilder.() -> Unit)
fun spoiler(value: String)
Link copied to clipboard
Link copied to clipboard
fun text(value: String)
Link copied to clipboard
fun underline(value: String)