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

Types

EntitiesBuilder
Link copied to clipboard
class EntitiesBuilder

This builder can be used to provide building of TextSources List

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

Functions

bold
Link copied to clipboard
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
fun String.boldHTML(): String
boldln
Link copied to clipboard
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
fun String.boldMarkdown(): String
boldMarkdownV2
Link copied to clipboard
fun String.boldMarkdownV2(): String
botCommand
Link copied to clipboard
botCommandln
Link copied to clipboard
inline fun EntitiesBuilder.botCommandln(command: String): EntitiesBuilder

Version of EntitiesBuilder.botCommand with new line at the end

buildEntities
Link copied to clipboard
fun buildEntities(separator: TextSource? = null, init: EntitiesBuilderBody): TextSourcesList
fun buildEntities(separator: String, init: EntitiesBuilderBody): List<TextSource>
cashTag
Link copied to clipboard
infix fun String.cashtag(parseMode: ParseMode): String
cashTagHtml
Link copied to clipboard
fun String.cashTagHtml(): String
cashTagln
Link copied to clipboard
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
fun String.cashTagMarkdown(): String
cashTagMarkdownV2
Link copied to clipboard
fun String.cashTagMarkdownV2(): String
code
Link copied to clipboard
inline fun EntitiesBuilder.code(code: String): EntitiesBuilder
infix fun String.code(parseMode: ParseMode): String
codeHTML
Link copied to clipboard
fun String.codeHTML(): String
codeln
Link copied to clipboard
inline fun EntitiesBuilder.codeln(code: String): EntitiesBuilder

Version of EntitiesBuilder.code with new line at the end

codeMarkdown
Link copied to clipboard
fun String.codeMarkdown(): String
codeMarkdownV2
Link copied to clipboard
fun String.codeMarkdownV2(): String
command
Link copied to clipboard
infix fun String.command(parseMode: ParseMode): String
fun String.command(adapt: String.() -> String): String
commandHTML
Link copied to clipboard
fun String.commandHTML(): String
commandMarkdown
Link copied to clipboard
fun String.commandMarkdown(): String
commandMarkdownV2
Link copied to clipboard
fun String.commandMarkdownV2(): String
createFormattedText
Link copied to clipboard
fun createFormattedText(entities: TextSourcesList, partLength: Int = textLength.last, mode: ParseMode = defaultParseMode): List<String>
createHtmlText
Link copied to clipboard
fun createHtmlText(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
createMarkdownText
Link copied to clipboard
fun createMarkdownText(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
createMarkdownV2Text
Link copied to clipboard
fun createMarkdownV2Text(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
email
Link copied to clipboard
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
fun String.emailHTML(): String
emailln
Link copied to clipboard
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
fun String.emailMarkdown(): String
emailMarkdownV2
Link copied to clipboard
fun String.emailMarkdownV2(): String
hashTag
Link copied to clipboard
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
fun String.hashTagHTML(): String
hashtagln
Link copied to clipboard
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
fun String.hashTagMarkdown(): String
hashTagMarkdownV2
Link copied to clipboard
fun String.hashTagMarkdownV2(): String
italic
Link copied to clipboard
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
fun String.italicHTML(): String
italicln
Link copied to clipboard
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
fun String.italicMarkdown(): String
italicMarkdownV2
Link copied to clipboard
fun String.italicMarkdownV2(): String
link
Link copied to clipboard
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
fun String.linkHTML(link: String): String
linkln
Link copied to clipboard
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
fun String.linkMarkdown(link: String): String
linkMarkdownV2
Link copied to clipboard
fun String.linkMarkdownV2(link: String): String
makeLink
Link copied to clipboard
inline fun makeLink(username: Username): String
makeLinkToMessage
Link copied to clipboard
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
fun makeUsernameLink(username: String): String
mention
Link copied to clipboard
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
fun String.mentionHTML(): String
mentionln
Link copied to clipboard
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
fun String.mentionMarkdown(): String
mentionMarkdownV2
Link copied to clipboard
fun String.mentionMarkdownV2(): String
phone
Link copied to clipboard
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
fun String.phoneHTML(): String
phoneln
Link copied to clipboard
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
fun String.phoneMarkdown(): String
phoneMarkdownV2
Link copied to clipboard
fun String.phoneMarkdownV2(): String
pre
Link copied to clipboard
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
fun String.preHTML(language: String? = null): String
preln
Link copied to clipboard
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
fun String.preMarkdown(language: String? = null): String
preMarkdownV2
Link copied to clipboard
fun String.preMarkdownV2(language: String? = null): String
regular
Link copied to clipboard
inline fun EntitiesBuilder.regular(text: String): EntitiesBuilder
infix fun String.regular(parseMode: ParseMode): String
regularHtml
Link copied to clipboard
fun String.regularHtml(): String
regularln
Link copied to clipboard
inline fun EntitiesBuilder.regularln(text: String): EntitiesBuilder
regularMarkdown
Link copied to clipboard
fun String.regularMarkdown(): String
regularMarkdownV2
Link copied to clipboard
fun String.regularMarkdownV2(): String
spoiler
Link copied to clipboard
inline fun EntitiesBuilder.spoiler(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.spoiler(text: String): EntitiesBuilder
inline fun EntitiesBuilder.spoiler(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.spoiler(noinline init: EntitiesBuilderBody): EntitiesBuilder
spoilerln
Link copied to clipboard
inline fun EntitiesBuilder.spoilerln(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.spoilerln(text: String): EntitiesBuilder
inline fun EntitiesBuilder.spoilerln(parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.spoiler with new line at the end

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

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

strikethrough
Link copied to clipboard
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
fun String.strikethroughHTML(): String
strikethroughln
Link copied to clipboard
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
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
fun String.strikethroughMarkdownV2(): String
textMentionHTML
Link copied to clipboard
fun String.textMentionHTML(userId: UserId): String
textMentionMarkdown
Link copied to clipboard
fun String.textMentionMarkdown(userId: UserId): String
textMentionMarkdownV2
Link copied to clipboard
fun String.textMentionMarkdownV2(userId: UserId): String
toHtmlCaptions
Link copied to clipboard
fun TextSourcesList.toHtmlCaptions(): List<String>
toHtmlExplanations
Link copied to clipboard
fun TextSourcesList.toHtmlExplanations(): List<String>
toHtmlTexts
Link copied to clipboard
fun TextContent.toHtmlTexts(): List<String>
fun TextSourcesList.toHtmlTexts(): List<String>
toMarkdownCaptions
Link copied to clipboard
fun TextSourcesList.toMarkdownCaptions(): List<String>
toMarkdownExplanations
Link copied to clipboard
fun TextSourcesList.toMarkdownExplanations(): List<String>
toMarkdownTexts
Link copied to clipboard
fun TextContent.toMarkdownTexts(): List<String>
fun TextSourcesList.toMarkdownTexts(): List<String>
toMarkdownV2Captions
Link copied to clipboard
fun TextSourcesList.toMarkdownV2Captions(): List<String>
toMarkdownV2Explanations
Link copied to clipboard
fun TextSourcesList.toMarkdownV2Explanations(): List<String>
toMarkdownV2Texts
Link copied to clipboard
fun TextContent.toMarkdownV2Texts(): List<String>
fun TextSourcesList.toMarkdownV2Texts(): List<String>
underline
Link copied to clipboard
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
fun String.underlineHTML(): String
underlineln
Link copied to clipboard
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
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
fun String.underlineMarkdownV2(): String

Properties

htmlBoldControl
Link copied to clipboard
const val htmlBoldControl: String
htmlCodeControl
Link copied to clipboard
const val htmlCodeControl: String
htmlItalicControl
Link copied to clipboard
const val htmlItalicControl: String
htmlPreControl
Link copied to clipboard
const val htmlPreControl: String
htmlStrikethroughControl
Link copied to clipboard
const val htmlStrikethroughControl: String
htmlUnderlineControl
Link copied to clipboard
const val htmlUnderlineControl: String
link
Link copied to clipboard
val Username.link: String
link
Link copied to clipboard
val Message.link: String?
link
Link copied to clipboard
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
const val markdownBoldControl: String
markdownCodeControl
Link copied to clipboard
const val markdownCodeControl: String
markdownItalicControl
Link copied to clipboard
const val markdownItalicControl: String
markdownPreControl
Link copied to clipboard
const val markdownPreControl: String
markdownV2ItalicEndControl
Link copied to clipboard
const val markdownV2ItalicEndControl: String
markdownV2ItalicUnderlineDelimiter
Link copied to clipboard
const val markdownV2ItalicUnderlineDelimiter: String
markdownV2StrikethroughControl
Link copied to clipboard
const val markdownV2StrikethroughControl: String
markdownV2UnderlineControl
Link copied to clipboard
const val markdownV2UnderlineControl: String
markdownV2UnderlineEndControl
Link copied to clipboard
const val markdownV2UnderlineEndControl: String
newLine
Link copied to clipboard
val newLine: RegularTextSource
stickerSetLink
Link copied to clipboard
val StickerSetName.stickerSetLink: TextLinkTextSource