1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-03 00:15:27 +00:00
tgbotapi/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt

27 lines
991 B
Kotlin
Raw Normal View History

2020-10-04 11:06:30 +00:00
package dev.inmo.tgbotapi.types.MessageEntity.textsources
2020-11-06 08:37:13 +00:00
import dev.inmo.tgbotapi.CommonAbstracts.*
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.utils.*
import dev.inmo.tgbotapi.utils.internal.*
import dev.inmo.tgbotapi.utils.internal.boldMarkdown
import dev.inmo.tgbotapi.utils.internal.boldMarkdownV2
2020-11-06 12:52:59 +00:00
/**
* @see bold
*/
data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val subsources: List<TextSource>
) : MultilevelTextSource {
2020-11-16 07:32:20 +00:00
override val markdown: String by lazy { source.boldMarkdown() }
override val markdownV2: String by lazy { boldMarkdownV2() }
override val html: String by lazy { boldHTML() }
}
2020-11-06 08:37:13 +00:00
@Suppress("NOTHING_TO_INLINE")
inline fun bold(parts: List<TextSource>) = BoldTextSource(parts.makeString(), parts)
2020-11-06 12:52:59 +00:00
@Suppress("NOTHING_TO_INLINE")
inline fun bold(vararg parts: TextSource) = bold(parts.toList())
@Suppress("NOTHING_TO_INLINE")
inline fun bold(text: String) = bold(regular(text))