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/TextLinkTextSource.kt

23 lines
789 B
Kotlin
Raw Normal View History

2020-10-04 11:06:30 +00:00
package dev.inmo.tgbotapi.types.MessageEntity.textsources
2021-01-09 14:59:37 +00:00
import dev.inmo.tgbotapi.CommonAbstracts.DirectInvocationOfTextSourceConstructor
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.internal.*
2021-04-12 17:23:18 +00:00
import kotlinx.serialization.Serializable
2020-11-06 12:52:59 +00:00
/**
* @see link
*/
2021-04-12 17:23:18 +00:00
@Serializable
2020-11-06 12:52:59 +00:00
data class TextLinkTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
val url: String
) : TextSource {
2020-11-16 07:32:20 +00:00
override val markdown: String by lazy { source.linkMarkdown(url) }
override val markdownV2: String by lazy { source.linkMarkdownV2(url) }
override val html: String by lazy { source.linkHTML(url) }
}
2020-11-06 12:52:59 +00:00
@Suppress("NOTHING_TO_INLINE")
inline fun link(text: String, url: String) = TextLinkTextSource(text, url)