1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-09-28 21:46:09 +00:00
tgbotapi/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MarkdownCaptionSourcer.kt

24 lines
961 B
Kotlin
Raw Normal View History

package com.github.insanusmokrassar.TelegramBotAPI.utils
2019-06-28 10:43:54 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.captionLength
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
import com.github.insanusmokrassar.TelegramBotAPI.types.textLength
fun createMarkdownText(
entities: List<MessageEntity>,
partLength: Int = 4096
): List<String> = createFormattedText(entities, partLength, MarkdownParseMode)
2019-06-28 10:43:54 +00:00
fun CaptionedInput.toMarkdownCaptions(): List<String> = createMarkdownText(
fullEntitiesList(),
captionLength.endInclusive + 1
)
fun TextContent.toMarkdownTexts(): List<String> = createMarkdownText(
fullEntitiesList(),
textLength.endInclusive + 1
)