mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-09-20 17:46:08 +00:00
25 lines
873 B
Kotlin
25 lines
873 B
Kotlin
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
|
|
|
import dev.inmo.tgbotapi.CommonAbstracts.DirectInvocationOfTextSourceConstructor
|
|
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
|
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
|
import dev.inmo.tgbotapi.utils.internal.*
|
|
import kotlinx.serialization.Serializable
|
|
|
|
/**
|
|
* @see pre
|
|
*/
|
|
@Serializable
|
|
data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
|
override val source: String,
|
|
val language: String? = null
|
|
) : TextSource {
|
|
override val markdown: String by lazy { source.preMarkdown(language) }
|
|
override val markdownV2: String by lazy { source.preMarkdownV2(language) }
|
|
override val html: String by lazy { source.preHTML(language) }
|
|
}
|
|
|
|
@Suppress("NOTHING_TO_INLINE")
|
|
inline fun pre(code: String, language: String? = null) = PreTextSource(code, language)
|
|
|