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

Types

Link copied to clipboard
class EntitiesBuilder

This builder can be used to provide building of TextSources List

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

Functions

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

Add bold using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.bold

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

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

infix fun String.bold(parseMode: ParseMode): String
Link copied to clipboard
fun String.boldHTML(): String
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

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

Add botCommand using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.botCommand

Link copied to clipboard
inline fun EntitiesBuilder.botCommandln(command: String): EntitiesBuilder

Version of EntitiesBuilder.botCommand with new line at the end

Link copied to clipboard
fun buildEntities(separator: TextSource? = null, init: EntitiesBuilderBody): TextSourcesList
fun buildEntities(separator: String, init: EntitiesBuilderBody): List<TextSource>
Link copied to clipboard
infix fun String.cashtag(parseMode: ParseMode): String
Link copied to clipboard
fun String.cashTagHtml(): String
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

Link copied to clipboard
fun String.cashTagMarkdown(): String
Link copied to clipboard
fun String.cashTagMarkdownV2(): String
Link copied to clipboard
inline fun EntitiesBuilder.code(code: String): EntitiesBuilder

Add code using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.code

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

Version of EntitiesBuilder.code with new line at the end

Link copied to clipboard
fun String.codeMarkdown(): String
Link copied to clipboard
fun String.codeMarkdownV2(): String
Link copied to clipboard
infix fun String.command(parseMode: ParseMode): String
fun String.command(adapt: String.() -> String): String
Link copied to clipboard
fun String.commandHTML(): String
Link copied to clipboard
fun String.commandMarkdown(): String
Link copied to clipboard
fun String.commandMarkdownV2(): String
Link copied to clipboard
fun createFormattedText(    entities: TextSourcesList,     partLength: Int = textLength.last,     mode: ParseMode = defaultParseMode): List<String>
Link copied to clipboard
fun createHtmlText(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
Link copied to clipboard
fun createMarkdownText(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
Link copied to clipboard
fun createMarkdownV2Text(entities: TextSourcesList, partLength: Int = textLength.last): List<String>
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

Add email using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.email

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

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

infix fun String.email(parseMode: ParseMode): String
Link copied to clipboard
fun String.emailHTML(): String
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

Link copied to clipboard
fun String.emailMarkdown(): String
Link copied to clipboard
fun String.emailMarkdownV2(): String
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

Add hashtag using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag

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

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

Link copied to clipboard
fun String.hashTagHTML(): String
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

Link copied to clipboard
fun String.hashTagMarkdown(): String
Link copied to clipboard
fun String.hashTagMarkdownV2(): String
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

Add italic using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.italic

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

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

infix fun String.italic(parseMode: ParseMode): String
Link copied to clipboard
fun String.italicHTML(): String
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

Link copied to clipboard
fun String.italicMarkdown(): String
Link copied to clipboard
fun String.italicMarkdownV2(): String
Link copied to clipboard
inline fun EntitiesBuilder.link(url: String): EntitiesBuilder
inline fun EntitiesBuilder.link(text: String, url: String): EntitiesBuilder

Add link using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.link

infix fun Pair<String, String>.link(parseMode: ParseMode): String
Link copied to clipboard
fun String.linkHTML(link: String): String
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

Link copied to clipboard
fun String.linkMarkdown(link: String): String
Link copied to clipboard
fun String.linkMarkdownV2(link: String): String
Link copied to clipboard
inline fun makeDeepLink(username: Username, startParameter: String): String
Link copied to clipboard
inline fun makeLink(username: Username): String
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)

Link copied to clipboard
inline fun makeTelegramDeepLink(username: Username, startParameter: String): String
inline fun makeTelegramDeepLink(username: String, startParameter: String): String
Link copied to clipboard
fun makeUsernameDeepLinkPrefix(username: String): String
Link copied to clipboard
fun makeUsernameLink(username: String): String
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

Add mention using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.mention

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

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

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
Link copied to clipboard
fun String.mentionHTML(): String
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

Link copied to clipboard
fun String.mentionMarkdown(): String
Link copied to clipboard
fun String.mentionMarkdownV2(): String
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

Add phone using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.phone

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

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

infix fun String.phone(parseMode: ParseMode): String
Link copied to clipboard
fun String.phoneHTML(): String
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

Link copied to clipboard
fun String.phoneMarkdown(): String
Link copied to clipboard
fun String.phoneMarkdownV2(): String
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

Add pre using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.pre

Link copied to clipboard
fun String.preHTML(language: String? = null): String
Link copied to clipboard
inline fun EntitiesBuilder.preln(code: String, language: String?): List<TextSource>

Version of EntitiesBuilder.pre with new line at the end

Link copied to clipboard
fun String.preMarkdown(language: String? = null): String
Link copied to clipboard
fun String.preMarkdownV2(language: String? = null): String
Link copied to clipboard
inline fun EntitiesBuilder.regular(text: String): EntitiesBuilder
infix fun String.regular(parseMode: ParseMode): String
Link copied to clipboard
fun String.regularHtml(): String
Link copied to clipboard
inline fun EntitiesBuilder.regularln(text: String): EntitiesBuilder
Link copied to clipboard
fun String.regularMarkdown(): String
Link copied to clipboard
fun String.regularMarkdownV2(): String
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

Add spoiler using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.spoiler

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

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

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

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

Add strikethrough using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough

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
Link copied to clipboard
fun String.strikethroughHTML(): String
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

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

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

Add underline using EntitiesBuilder.add with dev.inmo.tgbotapi.types.MessageEntity.textsources.underline

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
Link copied to clipboard
fun String.underlineHTML(): String
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

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

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

Properties

Link copied to clipboard
val Username.deepLinkPrefix: String
Link copied to clipboard
const val htmlBoldControl: String
Link copied to clipboard
const val htmlCodeControl: String
Link copied to clipboard
const val htmlItalicControl: String
Link copied to clipboard
const val htmlPreControl: String
Link copied to clipboard
const val htmlStrikethroughControl: String
Link copied to clipboard
const val htmlUnderlineControl: String
Link copied to clipboard
val Username.link: String
val Message.link: String?
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

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