mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-06-03 00:15:27 +00:00
23 lines
734 B
Kotlin
23 lines
734 B
Kotlin
|
package dev.inmo.tgbotapi.types.message.textsources
|
||
|
|
||
|
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)
|
||
|
|