2019-03-27 01:43:36 +00:00
|
|
|
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
|
|
|
|
2019-06-28 10:43:54 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
2019-03-27 01:43:36 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.captionLength
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.textLength
|
|
|
|
|
|
|
|
fun createHtmlText(
|
|
|
|
entities: List<MessageEntity>,
|
|
|
|
partLength: Int = 4096
|
|
|
|
): List<String> = createFormattedText(entities, partLength, HTMLParseMode)
|
|
|
|
|
2019-06-28 10:43:54 +00:00
|
|
|
fun CaptionedInput.toHtmlCaptions(): List<String> = createHtmlText(
|
2019-03-27 01:43:36 +00:00
|
|
|
fullEntitiesList(),
|
|
|
|
captionLength.endInclusive + 1
|
|
|
|
)
|
|
|
|
|
|
|
|
fun TextContent.toHtmlTexts(): List<String> = createHtmlText(
|
|
|
|
fullEntitiesList(),
|
|
|
|
textLength.endInclusive + 1
|
|
|
|
)
|