Package dev.inmo.tgbotapi.utils

Types

Link copied to clipboard
object BuiltinMimeTypes
Link copied to clipboard
fun interface ByteReadChannelAllocator
object ByteReadChannelAllocatorDeserializationStrategy : DeserializationStrategy<ByteReadChannelAllocator>
Link copied to clipboard
class EntitiesBuilder(val separator: TextSource? = null)

This builder can be used to provide building of TextSources List

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

File name like hello.jpg

Link copied to clipboard
open class MatrixBuilder<T>
Link copied to clipboard
expect class MimeType
actual class MimeType
actual class MimeType : MimeType
Link copied to clipboard
object MimeTypeSerializer : KSerializer<MimeType>
Link copied to clipboard
open class RowBuilder<T>
Link copied to clipboard
class TelegramAPIUrlsKeeper(    token: String,     hostUrl: String = telegramBotAPIDefaultUrl,     urlsSuffixes: String = "")

Functions

Link copied to clipboard
expect suspend fun ByteReadChannel.asInput(): Input
actual suspend fun ByteReadChannel.asInput(): Input
actual suspend fun ByteReadChannel.asInput(): Input
Link copied to clipboard
fun String.asMimeType(): MimeType
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

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

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
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
inline fun buildEntities(separator: TextSource? = null, init: EntitiesBuilderBody): TextSourcesList
inline fun buildEntities(separator: String, init: EntitiesBuilderBody): List<TextSource>
Link copied to clipboard
fun buildMimeType(raw: String): MimeType
Link copied to clipboard
inline fun EntitiesBuilder.cashTag(vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.cashTag(text: String): EntitiesBuilder
inline fun EntitiesBuilder.cashTag(parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.cashTag(noinline init: EntitiesBuilderBody): EntitiesBuilder

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

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
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
inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, text: String): EntitiesBuilder
inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, parts: TextSourcesList): EntitiesBuilder
inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, noinline init: EntitiesBuilderBody): EntitiesBuilder

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

Link copied to clipboard
inline fun EntitiesBuilder.customEmojiln(customEmojiId: CustomEmojiId, vararg parts: TextSource): EntitiesBuilder
inline fun EntitiesBuilder.customEmojiln(customEmojiId: CustomEmojiId, text: String): EntitiesBuilder
inline fun EntitiesBuilder.customEmojiln(customEmojiId: CustomEmojiId, parts: TextSourcesList): EntitiesBuilder

Version of EntitiesBuilder.customEmoji with new line at the end

inline fun EntitiesBuilder.customEmojiln(customEmojiId: CustomEmojiId, noinline init: EntitiesBuilderBody): EntitiesBuilder

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

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

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

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 <T> flatMatrix(vararg elements: T): Matrix<T>
fun <T> flatMatrix(block: RowBuilder<T>.() -> Unit): Matrix<T>
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

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

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
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

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

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
inline fun EntitiesBuilder.link(url: String): EntitiesBuilder
inline fun EntitiesBuilder.link(text: String, url: String): EntitiesBuilder
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 <K, V> Map<K, V?>.mapNotNullValues(): Map<K, V>
Link copied to clipboard
fun <K, V> mapOfNotNull(vararg pairs: Pair<K, V?>): Map<K, V>
Link copied to clipboard
fun JsonObject.mapWithCommonValues(): Map<String, Any>
Link copied to clipboard
fun <T> matrix(block: MatrixBuilder<T>.() -> Unit): Matrix<T>
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

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

inline fun EntitiesBuilder.mention(user: User, vararg parts: TextSource): EntitiesBuilder
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
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

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

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
operator fun <T> RowBuilder<T>.plus(t: T): Boolean
Link copied to clipboard
inline fun EntitiesBuilder.pre(code: String, language: String?): EntitiesBuilder
Link copied to clipboard
inline fun EntitiesBuilder.preln(code: String, language: String?): EntitiesBuilder

Version of EntitiesBuilder.pre with new line at the end

Link copied to clipboard
inline fun EntitiesBuilder.regular(text: String): EntitiesBuilder
Link copied to clipboard
inline fun EntitiesBuilder.regularln(text: String): EntitiesBuilder

Will add simple dev.inmo.tgbotapi.types.message.textsources.regular and "\n" at the end

Link copied to clipboard
fun <T> row(block: RowBuilder<T>.() -> Unit): List<T>
fun <T> MatrixBuilder<T>.row(vararg elements: T)
fun <T> MatrixBuilder<T>.row(block: RowBuilder<T>.() -> Unit)
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

Add spoiler using EntitiesBuilder.add with dev.inmo.tgbotapi.types.message.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
inline fun EntitiesBuilder.strikethrough(noinline init: EntitiesBuilderBody): EntitiesBuilder

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

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 <T : Any> T.toJson(serializer: SerializationStrategy<T>): JsonObject
Link copied to clipboard
fun <T : Any> T.toJsonWithoutNulls(serializer: SerializationStrategy<T>): JsonObject
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.message.textsources.underline. Will reuse separator config from buildEntities

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 JsonArray.withoutNulls(): JsonArray
fun JsonObject.withoutNulls(): JsonObject

Properties

Link copied to clipboard
val String.fileExtension: String
Link copied to clipboard
val String.filenameFromUrl: FileName
Link copied to clipboard
const val lowLevelRiskFeatureMessage: String
Link copied to clipboard
val newLine: RegularTextSource
Link copied to clipboard
const val telegramBotAPIDefaultUrl: String