Package dev.inmo.tgbotapi.extensions.utils.formatting

Types

EntitiesBuilder
Link copied to clipboard
common
class EntitiesBuilder

This builder can be used to provide building of TextSources List

EntitiesBuilderBody
Link copied to clipboard
common
typealias EntitiesBuilderBody = EntitiesBuilder.() -> Unit

Functions

bold
Link copied to clipboard
common
inline fun EntitiesBuilder.bold(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.bold(text: String): EntitiesBuilder
inline fun EntitiesBuilder.bold(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.bold(noinline init: EntitiesBuilderBody): EntitiesBuilder
infix fun String.bold(parseMode: ParseMode): String
boldHTML
Link copied to clipboard
common
fun String.boldHTML(): String
boldln
Link copied to clipboard
common
inline fun EntitiesBuilder.boldln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.boldln(text: String): EntitiesBuilder
inline fun EntitiesBuilder.boldln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.bold with new line at the end

inline fun EntitiesBuilder.boldln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.bold with new line at the end. Will reuse separator config from buildEntities

boldMarkdown
Link copied to clipboard
common
fun String.boldMarkdown(): String
boldMarkdownV2
Link copied to clipboard
common
fun String.boldMarkdownV2(): String
botCommand
Link copied to clipboard
common
botCommandln
Link copied to clipboard
common
inline fun EntitiesBuilder.botCommandln(command: String): EntitiesBuilder

Version of EntitiesBuilder.botCommand with new line at the end

buildEntities
Link copied to clipboard
common
fun buildEntities(separator: TextSource? = null, init: EntitiesBuilderBody): TextSourcesList
fun buildEntities(separator: String, init: EntitiesBuilderBody): List<TextSource>
cashTag
Link copied to clipboard
common
infix fun String.cashtag(parseMode: ParseMode): String
cashTagHtml
Link copied to clipboard
common
fun String.cashTagHtml(): String
cashTagln
Link copied to clipboard
common
inline fun EntitiesBuilder.cashTagln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.cashTagln(text: String): EntitiesBuilder
inline fun EntitiesBuilder.cashTagln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.cashTag with new line at the end

inline fun EntitiesBuilder.cashTagln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.cashTag with new line at the end. Will reuse separator config from buildEntities

cashTagMarkdown
Link copied to clipboard
common
fun String.cashTagMarkdown(): String
cashTagMarkdownV2
Link copied to clipboard
common
fun String.cashTagMarkdownV2(): String
code
Link copied to clipboard
common
infix fun String.code(parseMode: ParseMode): String
codeHTML
Link copied to clipboard
common
fun String.codeHTML(): String
codeln
Link copied to clipboard
common
inline fun EntitiesBuilder.codeln(code: String): EntitiesBuilder

Version of EntitiesBuilder.code with new line at the end

codeMarkdown
Link copied to clipboard
common
fun String.codeMarkdown(): String
codeMarkdownV2
Link copied to clipboard
common
fun String.codeMarkdownV2(): String
command
Link copied to clipboard
common
infix fun String.command(parseMode: ParseMode): String
fun String.command(adapt: String.() -> String): String
commandHTML
Link copied to clipboard
common
fun String.commandHTML(): String
commandMarkdown
Link copied to clipboard
common
fun String.commandMarkdown(): String
commandMarkdownV2
Link copied to clipboard
common
fun String.commandMarkdownV2(): String
createFormattedText
Link copied to clipboard
common
fun createFormattedText(entities: TextSourcesList, partLength: Int = textLength.last, mode: ParseMode = defaultParseMode): List<String>
createHtmlText
Link copied to clipboard
common
fun createHtmlText(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
createMarkdownText
Link copied to clipboard
common
fun createMarkdownText(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
createMarkdownV2Text
Link copied to clipboard
common
fun createMarkdownV2Text(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
email
Link copied to clipboard
common
inline fun EntitiesBuilder.email(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.email(emailAddress: String): EntitiesBuilder
inline fun EntitiesBuilder.email(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.email(noinline init: EntitiesBuilderBody): EntitiesBuilder
infix fun String.email(parseMode: ParseMode): String
emailHTML
Link copied to clipboard
common
fun String.emailHTML(): String
emailln
Link copied to clipboard
common
inline fun EntitiesBuilder.emailln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.emailln(emailAddress: String): EntitiesBuilder
inline fun EntitiesBuilder.emailln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.email with new line at the end

inline fun EntitiesBuilder.emailln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.email with new line at the end. Will reuse separator config from buildEntities

emailMarkdown
Link copied to clipboard
common
fun String.emailMarkdown(): String
emailMarkdownV2
Link copied to clipboard
common
fun String.emailMarkdownV2(): String
hashTag
Link copied to clipboard
common
inline fun EntitiesBuilder.hashtag(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.hashtag(hashtag: String): EntitiesBuilder
inline fun EntitiesBuilder.hashtag(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.hashtag(noinline init: EntitiesBuilderBody): EntitiesBuilder
hashTagHTML
Link copied to clipboard
common
fun String.hashTagHTML(): String
hashtagln
Link copied to clipboard
common
inline fun EntitiesBuilder.hashtagln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.hashtagln(hashtag: String): EntitiesBuilder
inline fun EntitiesBuilder.hashtagln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.hashtag with new line at the end

inline fun EntitiesBuilder.hashtagln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.hashtag with new line at the end. Will reuse separator config from buildEntities

hashTagMarkdown
Link copied to clipboard
common
fun String.hashTagMarkdown(): String
hashTagMarkdownV2
Link copied to clipboard
common
fun String.hashTagMarkdownV2(): String
italic
Link copied to clipboard
common
inline fun EntitiesBuilder.italic(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.italic(text: String): EntitiesBuilder
inline fun EntitiesBuilder.italic(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.italic(noinline init: EntitiesBuilderBody): EntitiesBuilder
infix fun String.italic(parseMode: ParseMode): String
italicHTML
Link copied to clipboard
common
fun String.italicHTML(): String
italicln
Link copied to clipboard
common
inline fun EntitiesBuilder.italicln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.italicln(text: String): EntitiesBuilder
inline fun EntitiesBuilder.italicln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.italic with new line at the end

inline fun EntitiesBuilder.italicln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.italic with new line at the end. Will reuse separator config from buildEntities

italicMarkdown
Link copied to clipboard
common
fun String.italicMarkdown(): String
italicMarkdownV2
Link copied to clipboard
common
fun String.italicMarkdownV2(): String
link
Link copied to clipboard
common
inline fun EntitiesBuilder.link(url: String): EntitiesBuilder
inline fun EntitiesBuilder.link(text: String, url: String): EntitiesBuilder
infix fun Pair<String, String>.link(parseMode: ParseMode): String
linkHTML
Link copied to clipboard
common
fun String.linkHTML(link: String): String
linkln
Link copied to clipboard
common
inline fun EntitiesBuilder.linkln(url: String): EntitiesBuilder
inline fun EntitiesBuilder.linkln(text: String, url: String): EntitiesBuilder

Version of EntitiesBuilder.link with new line at the end

linkMarkdown
Link copied to clipboard
common
fun String.linkMarkdown(link: String): String
linkMarkdownV2
Link copied to clipboard
common
fun String.linkMarkdownV2(link: String): String
makeLink
Link copied to clipboard
common
inline fun makeLink(username: Username): String
makeLinkToMessage
Link copied to clipboard
common
fun makeLinkToMessage(username: Username, messageId: MessageIdentifier): String
fun makeLinkToMessage(chat: UsernameChat, messageId: MessageIdentifier): String?
fun makeLinkToMessage(username: String, messageId: MessageIdentifier): String
fun makeLinkToMessage(chat: Chat, messageId: MessageIdentifier): String?

Link which can be used as by any user to get access to Message. Returns null in case when there are no known way to build link (for PrivateChats, for example)

makeUsernameLink
Link copied to clipboard
common
fun makeUsernameLink(username: String): String
mention
Link copied to clipboard
common
inline fun EntitiesBuilder.mention(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.mention(whoToMention: String): EntitiesBuilder
inline fun EntitiesBuilder.mention(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.mention(text: String, user: User): EntitiesBuilder
inline fun EntitiesBuilder.mention(parts: TextSourcesList, user: User): EntitiesBuilder
inline fun EntitiesBuilder.mention(noinline init: EntitiesBuilderBody): EntitiesBuilder
infix fun Pair<String, ChatId>.mention(parseMode: ParseMode): String
infix fun String.mention(parseMode: ParseMode): String
inline fun EntitiesBuilder.mention(user: User, vararg parts: TextSource): EntitiesBuilder
mentionHTML
Link copied to clipboard
common
fun String.mentionHTML(): String
mentionln
Link copied to clipboard
common
inline fun EntitiesBuilder.mentionln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.mentionln(whoToMention: String): EntitiesBuilder
inline fun EntitiesBuilder.mentionln(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.mentionln(user: User, vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.mentionln(text: String, user: User): EntitiesBuilder
inline fun EntitiesBuilder.mentionln(parts: TextSourcesList, user: User): EntitiesBuilder

Version of EntitiesBuilder.mention with new line at the end

inline fun EntitiesBuilder.mentionln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.mention with new line at the end. Will reuse separator config from buildEntities

mentionMarkdown
Link copied to clipboard
common
fun String.mentionMarkdown(): String
mentionMarkdownV2
Link copied to clipboard
common
fun String.mentionMarkdownV2(): String
phone
Link copied to clipboard
common
inline fun EntitiesBuilder.phone(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.phone(number: String): EntitiesBuilder
inline fun EntitiesBuilder.phone(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.phone(noinline init: EntitiesBuilderBody): EntitiesBuilder
infix fun String.phone(parseMode: ParseMode): String
phoneHTML
Link copied to clipboard
common
fun String.phoneHTML(): String
phoneln
Link copied to clipboard
common
inline fun EntitiesBuilder.phoneln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.phoneln(number: String): EntitiesBuilder
inline fun EntitiesBuilder.phoneln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.phone with new line at the end

inline fun EntitiesBuilder.phoneln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.phone with new line at the end. Will reuse separator config from buildEntities

phoneMarkdown
Link copied to clipboard
common
fun String.phoneMarkdown(): String
phoneMarkdownV2
Link copied to clipboard
common
fun String.phoneMarkdownV2(): String
pre
Link copied to clipboard
common
infix fun String.pre(parseMode: ParseMode): String
fun String.pre(parseMode: ParseMode, language: String? = null): String
inline fun EntitiesBuilder.pre(code: String, language: String?): EntitiesBuilder
preHTML
Link copied to clipboard
common
fun String.preHTML(language: String? = null): String
preln
Link copied to clipboard
common
inline fun EntitiesBuilder.preln(code: String, language: String?): List<TextSource>

Version of EntitiesBuilder.pre with new line at the end

preMarkdown
Link copied to clipboard
common
fun String.preMarkdown(language: String? = null): String
preMarkdownV2
Link copied to clipboard
common
fun String.preMarkdownV2(language: String? = null): String
regular
Link copied to clipboard
common
inline fun EntitiesBuilder.regular(text: String): EntitiesBuilder
infix fun String.regular(parseMode: ParseMode): String
regularHtml
Link copied to clipboard
common
fun String.regularHtml(): String
regularln
Link copied to clipboard
common
inline fun EntitiesBuilder.regularln(text: String): EntitiesBuilder
regularMarkdown
Link copied to clipboard
common
fun String.regularMarkdown(): String
regularMarkdownV2
Link copied to clipboard
common
fun String.regularMarkdownV2(): String
strikethrough
Link copied to clipboard
common
inline fun EntitiesBuilder.strikethrough(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.strikethrough(text: String): EntitiesBuilder
inline fun EntitiesBuilder.strikethrough(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.strikethrough(noinline init: EntitiesBuilderBody): EntitiesBuilder

Add strikethrough using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough. Will reuse separator config from buildEntities

infix fun String.strikethrough(parseMode: ParseMode): String
strikethroughHTML
Link copied to clipboard
common
fun String.strikethroughHTML(): String
strikethroughln
Link copied to clipboard
common
inline fun EntitiesBuilder.strikethroughln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.strikethroughln(text: String): EntitiesBuilder
inline fun EntitiesBuilder.strikethroughln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.strikethrough with new line at the end

inline fun EntitiesBuilder.strikethroughln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.strikethrough with new line at the end. Will reuse separator config from buildEntities

strikethroughMarkdown
Link copied to clipboard
common
fun String.strikethroughMarkdown(): String

Crutch for support of strikethrough in default markdown. Simply add modifier, but it will not look like correct

strikethroughMarkdownV2
Link copied to clipboard
common
fun String.strikethroughMarkdownV2(): String
textMentionHTML
Link copied to clipboard
common
fun String.textMentionHTML(userId: UserId): String
textMentionMarkdown
Link copied to clipboard
common
fun String.textMentionMarkdown(userId: UserId): String
textMentionMarkdownV2
Link copied to clipboard
common
fun String.textMentionMarkdownV2(userId: UserId): String
toHtmlCaptions
Link copied to clipboard
common
fun TextSourcesList.toHtmlCaptions(): List<String>
toHtmlExplanations
Link copied to clipboard
common
fun TextSourcesList.toHtmlExplanations(): List<String>
toHtmlTexts
Link copied to clipboard
common
fun TextContent.toHtmlTexts(): List<String>
fun TextSourcesList.toHtmlTexts(): List<String>
toMarkdownCaptions
Link copied to clipboard
common
fun TextSourcesList.toMarkdownCaptions(): List<String>
toMarkdownExplanations
Link copied to clipboard
common
fun TextSourcesList.toMarkdownExplanations(): List<String>
toMarkdownTexts
Link copied to clipboard
common
fun TextContent.toMarkdownTexts(): List<String>
fun TextSourcesList.toMarkdownTexts(): List<String>
toMarkdownV2Captions
Link copied to clipboard
common
fun TextSourcesList.toMarkdownV2Captions(): List<String>
toMarkdownV2Explanations
Link copied to clipboard
common
fun TextSourcesList.toMarkdownV2Explanations(): List<String>
toMarkdownV2Texts
Link copied to clipboard
common
fun TextContent.toMarkdownV2Texts(): List<String>
fun TextSourcesList.toMarkdownV2Texts(): List<String>
underline
Link copied to clipboard
common
inline fun EntitiesBuilder.underline(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.underline(text: String): EntitiesBuilder
inline fun EntitiesBuilder.underline(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.underline(noinline init: EntitiesBuilderBody): EntitiesBuilder

Add underline using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.underline. Will reuse separator config from buildEntities

infix fun String.underline(parseMode: ParseMode): String
underlineHTML
Link copied to clipboard
common
fun String.underlineHTML(): String
underlineln
Link copied to clipboard
common
inline fun EntitiesBuilder.underlineln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.underlineln(text: String): EntitiesBuilder
inline fun EntitiesBuilder.underlineln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.underline with new line at the end

inline fun EntitiesBuilder.underlineln(noinline init: EntitiesBuilderBody): EntitiesBuilder

Version of EntitiesBuilder.underline with new line at the end. Will reuse separator config from buildEntities

underlineMarkdown
Link copied to clipboard
common
fun String.underlineMarkdown(): String

Crutch for support of underline in default markdown. Simply add modifier, but it will not look like correct

underlineMarkdownV2
Link copied to clipboard
common
fun String.underlineMarkdownV2(): String

Properties

htmlBoldControl
Link copied to clipboard
common
const val htmlBoldControl: String
htmlCodeControl
Link copied to clipboard
common
const val htmlCodeControl: String
htmlItalicControl
Link copied to clipboard
common
const val htmlItalicControl: String
htmlPreControl
Link copied to clipboard
common
const val htmlPreControl: String
htmlStrikethroughControl
Link copied to clipboard
common
const val htmlStrikethroughControl: String
htmlUnderlineControl
Link copied to clipboard
common
const val htmlUnderlineControl: String
link
Link copied to clipboard
common
val Username.link: String
link
Link copied to clipboard
common
val Message.link: String?
link
Link copied to clipboard
common
val Chat.link: String?

Link which can be used as by any user to get access to Chat. Returns null in case when there are no known way to build link

markdownBoldControl
Link copied to clipboard
common
const val markdownBoldControl: String
markdownCodeControl
Link copied to clipboard
common
const val markdownCodeControl: String
markdownItalicControl
Link copied to clipboard
common
const val markdownItalicControl: String
markdownPreControl
Link copied to clipboard
common
const val markdownPreControl: String
markdownV2ItalicEndControl
Link copied to clipboard
common
const val markdownV2ItalicEndControl: String
markdownV2ItalicUnderlineDelimiter
Link copied to clipboard
common
const val markdownV2ItalicUnderlineDelimiter: String
markdownV2StrikethroughControl
Link copied to clipboard
common
const val markdownV2StrikethroughControl: String
markdownV2UnderlineControl
Link copied to clipboard
common
const val markdownV2UnderlineControl: String
markdownV2UnderlineEndControl
Link copied to clipboard
common
const val markdownV2UnderlineEndControl: String
newLine
Link copied to clipboard
common
val newLine: RegularTextSource
stickerSetLink
Link copied to clipboard
common
val StickerSetName.stickerSetLink: TextLinkTextSource