Package-level declarations

Types

Link copied to clipboard
@Serializable
data class InputRichMessage

Describes a rich message to be sent. Exactly one of the fields html or markdown must be used. Use the InputRichMessageHTML and InputRichMessageMarkdown factories to build an instance.

Link copied to clipboard
@Serializable(with = RichBlockSerializer::class)
sealed interface RichBlock

Represents a block in a rich formatted message.

Link copied to clipboard
@Serializable
data class RichBlockAnchor(val name: String) : RichBlock

A block with an anchor.

Link copied to clipboard
@Serializable
data class RichBlockAnimation(val animation: AnimationFile, val hasSpoiler: Boolean? = null, val caption: RichBlockCaption? = null) : RichBlockMedia

A block with an animation.

Link copied to clipboard
@Serializable
data class RichBlockAudio(val audio: AudioFile, val caption: RichBlockCaption? = null) : RichBlockMedia

A block with a music file.

Link copied to clipboard
@Serializable
data class RichBlockBlockQuotation(val blocks: List<RichBlock>, val credit: RichText? = null) : RichBlock

A block quotation.

Link copied to clipboard
@Serializable
data class RichBlockCaption(val text: RichText, val credit: RichText? = null)

Caption of a rich formatted block.

Link copied to clipboard
@Serializable
data class RichBlockCollage(val blocks: List<RichBlock>, val caption: RichBlockCaption? = null) : RichBlock

A collage.

Link copied to clipboard
@Serializable
data class RichBlockDetails(val summary: RichText, val blocks: List<RichBlock>, val isOpen: Boolean? = null) : RichBlock

An expandable block for details disclosure.

Link copied to clipboard
@Serializable
class RichBlockDivider : RichBlock

A divider.

Link copied to clipboard
@Serializable
data class RichBlockFooter(val text: RichText) : RichBlock

A footer.

Link copied to clipboard
@Serializable
data class RichBlockList(val items: List<RichBlockListItem>) : RichBlock

A list of blocks.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class RichBlockListItem(val label: String, val blocks: List<RichBlock>, val hasCheckbox: Boolean? = null, val isChecked: Boolean? = null, val value: Int? = null, val labelType: String? = null)

An item of a RichBlockList.

Link copied to clipboard
@Serializable
data class RichBlockMap(val location: StaticLocation, val zoom: Int, val width: Int, val height: Int, val caption: RichBlockCaption? = null) : RichBlock

A block with a map.

Link copied to clipboard
@Serializable
data class RichBlockMathematicalExpression(val expression: String) : RichBlock

A block with a mathematical expression in LaTeX format.

Link copied to clipboard
@Serializable(with = RichBlockSerializer::class)
sealed interface RichBlockMedia : RichBlock
Link copied to clipboard
@Serializable
data class RichBlockParagraph(val text: RichText) : RichBlock

A text paragraph.

Link copied to clipboard
@Serializable
data class RichBlockPhoto(val photo: PhotoFile, val hasSpoiler: Boolean? = null, val caption: RichBlockCaption? = null) : RichBlockMedia

A block with a photo.

Link copied to clipboard
@Serializable
data class RichBlockPreformatted(val text: RichText, val language: String? = null) : RichBlock

A preformatted text block.

Link copied to clipboard
@Serializable
data class RichBlockPullQuotation(val text: RichText, val credit: RichText? = null) : RichBlock

A quotation with centered text.

Link copied to clipboard

Builder of a List of RichBlocks - the root of the rich message DSL. Text-bearing and container blocks have their own DSL functions; file/cell-heavy blocks (media, collage, slideshow, table, map) can be appended with add / unary plus.

Link copied to clipboard
@Serializable
data class RichBlockSectionHeading(val text: RichText, val level: Int) : RichBlock

A section heading.

Link copied to clipboard
object RichBlockSerializer : JsonContentPolymorphicSerializer<RichBlock>
Link copied to clipboard
@Serializable
data class RichBlockSlideshow(val blocks: List<RichBlock>, val caption: RichBlockCaption? = null) : RichBlock

A slideshow.

Link copied to clipboard
@Serializable
data class RichBlockTable(val cells: List<List<RichBlockTableCell>>, val isBordered: Boolean? = null, val isStriped: Boolean? = null, val caption: RichText? = null) : RichBlock

A table.

Link copied to clipboard
@Serializable
data class RichBlockTableCell(val text: RichText? = null, val isHeader: Boolean? = null, val colspan: Int? = null, val rowspan: Int? = null, val align: String, val valign: String)

A cell in a RichBlockTable.

Link copied to clipboard
@Serializable
data class RichBlockThinking(val text: RichText) : RichBlock

A block with a "Thinking…" placeholder. May be used only in sendRichMessageDraft.

Link copied to clipboard
@Serializable
data class RichBlockVideo(val video: VideoFile, val hasSpoiler: Boolean? = null, val caption: RichBlockCaption? = null) : RichBlockMedia

A block with a video.

Link copied to clipboard
@Serializable
data class RichBlockVoiceNote(val voiceNote: VoiceFile, val caption: RichBlockCaption? = null) : RichBlockMedia

A block with a voice note.

Link copied to clipboard
@Serializable(with = RichTextSerializer::class)
sealed interface RichText

Represents a rich formatted text. It can be either a plain text (RichTextPlain), a group of rich texts (RichTextGroup) or any of RichTextEntity subtypes.

Link copied to clipboard
@Serializable
data class RichTextAnchor(val name: String) : RichTextEntity

An anchor.

Link copied to clipboard
@Serializable
data class RichTextAnchorLink(val text: RichText, val anchorName: String) : RichTextEntity

A link to an anchor.

Link copied to clipboard
@Serializable
data class RichTextBankCardNumber(val text: RichText, val bankCardNumber: String) : RichTextEntity

A RichTextEntity with a bank card number.

Link copied to clipboard
@Serializable
data class RichTextBold(val text: RichText) : RichTextEntity
Link copied to clipboard
@Serializable
data class RichTextBotCommand(val text: RichText, val botCommand: String) : RichTextEntity

A bot command.

Link copied to clipboard

Builder of a single RichText. Each call appends a part; build returns a RichTextPlain/RichTextEntity when there is exactly one part, a RichTextGroup otherwise.

Link copied to clipboard
@Serializable
data class RichTextCashtag(val text: RichText, val cashtag: String) : RichTextEntity

A cashtag.

Link copied to clipboard
@Serializable
data class RichTextCode(val text: RichText) : RichTextEntity

A monowidth RichTextEntity.

Link copied to clipboard
@Serializable
data class RichTextCustomEmoji(val customEmojiId: CustomEmojiId, val alternativeText: String) : RichTextEntity

A custom emoji RichTextEntity.

Link copied to clipboard
@Serializable
data class RichTextDateTime(val text: RichText, val unixTime: TelegramDate, val dateTimeFormat: String) : RichTextEntity

A formatted date and time RichTextEntity.

Link copied to clipboard
annotation class RichTextDsl

DslMarker for the rich message builders, so the inner RichTextBuilder, RichBlocksBuilder and RichBlockListBuilder scopes do not leak their receivers into each other.

Link copied to clipboard
@Serializable
data class RichTextEmailAddress(val text: RichText, val emailAddress: String) : RichTextEntity

A RichTextEntity with an email address.

Link copied to clipboard
@Serializable(with = RichTextEntitySerializer::class)
sealed interface RichTextEntity : RichText

Any typed (formatted) part of a RichText. Serialized as a JSON object with the type discriminator.

Link copied to clipboard
object RichTextEntitySerializer : JsonContentPolymorphicSerializer<RichTextEntity>
Link copied to clipboard
@Serializable
data class RichTextGroup(val parts: List<RichText>) : RichText

A group of RichTexts. Serialized as a JSON array.

Link copied to clipboard
@Serializable
data class RichTextHashtag(val text: RichText, val hashtag: String) : RichTextEntity

A hashtag.

Link copied to clipboard
@Serializable
data class RichTextInfo(val blocks: List<RichBlock>, val isRtl: Boolean? = null)

Rich formatted message.

Link copied to clipboard
@Serializable
data class RichTextItalic(val text: RichText) : RichTextEntity

An italicized RichTextEntity.

Link copied to clipboard
@Serializable
data class RichTextMarked(val text: RichText) : RichTextEntity

A marked RichTextEntity.

Link copied to clipboard
@Serializable
data class RichTextMathematicalExpression(val expression: String) : RichTextEntity

A mathematical expression in LaTeX format.

Link copied to clipboard
@Serializable
data class RichTextMention(val text: RichText, val username: String) : RichTextEntity

A mention by a username.

Link copied to clipboard
@Serializable
data class RichTextPhoneNumber(val text: RichText, val phoneNumber: String) : RichTextEntity

A RichTextEntity with a phone number.

Link copied to clipboard
@Serializable
data class RichTextPlain(val text: String) : RichText

A plain (non-formatted) part of a RichText. Serialized as a bare JSON string.

Link copied to clipboard
@Serializable
data class RichTextReference(val text: RichText, val name: String) : RichTextEntity

A reference.

Link copied to clipboard
@Serializable
data class RichTextReferenceLink(val text: RichText, val referenceName: String) : RichTextEntity

A link to a reference.

Link copied to clipboard
object RichTextSerializer : KSerializer<RichText>
Link copied to clipboard
@Serializable
data class RichTextSpoiler(val text: RichText) : RichTextEntity

A RichTextEntity covered by a spoiler.

Link copied to clipboard
@Serializable
data class RichTextStrikethrough(val text: RichText) : RichTextEntity

A strikethrough RichTextEntity.

Link copied to clipboard
@Serializable
data class RichTextSubscript(val text: RichText) : RichTextEntity

A subscript RichTextEntity.

Link copied to clipboard
@Serializable
data class RichTextSuperscript(val text: RichText) : RichTextEntity

A superscript RichTextEntity.

Link copied to clipboard
@Serializable
data class RichTextTextMention(val text: RichText, val user: User) : RichTextEntity

A mention of a Telegram user by their identifier.

Link copied to clipboard
@Serializable
data class RichTextUnderline(val text: RichText) : RichTextEntity

An underlined RichTextEntity.

Link copied to clipboard
@Serializable
data class RichTextUrl(val text: RichText, val url: String) : RichTextEntity

A RichTextEntity with a link.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The nested RichBlocks directly contained by this block, or an empty list for leaf blocks. Container blocks (RichBlockList via its RichBlockListItem.blocks, RichBlockBlockQuotation, RichBlockCollage, RichBlockSlideshow and RichBlockDetails) expose their children here.

Functions

Link copied to clipboard

Builds a List of RichBlocks using the RichBlocksBuilder DSL.

Link copied to clipboard

Builds a RichText using the RichTextBuilder DSL.

Link copied to clipboard
fun buildRichTextInfo(isRtl: Boolean? = null, block: RichBlocksBuilder.() -> Unit): RichTextInfo

Builds a RichTextInfo using the RichBlocksBuilder DSL.

Link copied to clipboard

Escapes all the richMarkdownSpecialCharacters of the receiver with a backslash so that the resulting string is represented literally in the Rich Markdown style.

Link copied to clipboard
fun InputRichMessageHTML(html: String, isRtl: Boolean? = null, skipEntityDetection: Boolean? = null): InputRichMessage

Creates an InputRichMessage with the content described using HTML formatting.

Link copied to clipboard
fun InputRichMessageMarkdown(markdown: String, isRtl: Boolean? = null, skipEntityDetection: Boolean? = null): InputRichMessage

Creates an InputRichMessage with the content described using Markdown formatting.

Link copied to clipboard

Walks this RichBlock and all of its subBlocks recursively (depth-first, this block first) and returns the first block for which block returns true, or null if none matches.

Link copied to clipboard

Builds the Rich HTML style source string for this list of RichBlocks. The resulting string may be passed to InputRichMessageHTML. See toRichMarkdown for the media note.

Link copied to clipboard

Builds the Rich Markdown style source string for this list of RichBlocks. The resulting string may be passed to InputRichMessageMarkdown.