2020-10-04 11:06:30 +00:00
|
|
|
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
2019-12-11 08:06:09 +00:00
|
|
|
|
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.*
|
2020-11-07 07:42:10 +00:00
|
|
|
import dev.inmo.tgbotapi.utils.internal.*
|
|
|
|
import dev.inmo.tgbotapi.utils.internal.phoneMarkdown
|
|
|
|
import dev.inmo.tgbotapi.utils.internal.phoneMarkdownV2
|
2019-12-11 08:06:09 +00:00
|
|
|
|
2020-11-06 12:52:59 +00:00
|
|
|
/**
|
|
|
|
* @see phone
|
|
|
|
*/
|
|
|
|
data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
2020-04-08 09:17:13 +00:00
|
|
|
override val source: String,
|
2020-11-12 10:37:17 +00:00
|
|
|
override val subsources: List<TextSource>
|
2020-01-05 13:24:17 +00:00
|
|
|
) : MultilevelTextSource {
|
2020-11-16 07:32:20 +00:00
|
|
|
override val markdown: String by lazy { source.phoneMarkdown() }
|
|
|
|
override val markdownV2: String by lazy { phoneMarkdownV2() }
|
|
|
|
override val html: String by lazy { phoneHTML() }
|
2019-12-11 08:06:09 +00:00
|
|
|
}
|
2020-11-06 12:52:59 +00:00
|
|
|
|
|
|
|
@Suppress("NOTHING_TO_INLINE")
|
|
|
|
inline fun phone(parts: List<TextSource>) = PhoneNumberTextSource(parts.makeString(), parts)
|
|
|
|
@Suppress("NOTHING_TO_INLINE")
|
|
|
|
inline fun phone(vararg parts: TextSource) = phone(parts.toList())
|
|
|
|
@Suppress("NOTHING_TO_INLINE")
|
|
|
|
inline fun phone(number: String) = phone(regular(number))
|
|
|
|
|