mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
TextSource analogues of MessageEntities
This commit is contained in:
parent
6f1f5e640a
commit
6dd701d33c
@ -19,6 +19,8 @@
|
||||
* `createFormattedText` method now accept `List<TextSource>`
|
||||
* `createHtmlText` method now accept `List<TextSource>`
|
||||
* `createMarkdownText` method now accept `List<TextSource>`
|
||||
* A lot of `TextSource` implementors was added. More info [here](src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/)
|
||||
* All `MessageEntity` implementations now are using new `TextSource` analogues as delegates
|
||||
|
||||
## 0.19.0 ImplicitReflection removing
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.BoldTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.boldHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.boldMarkdown
|
||||
|
||||
@ -7,7 +9,4 @@ data class BoldTextMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.boldMarkdown()
|
||||
override val asHtmlSource: String = sourceString.boldHTML()
|
||||
}
|
||||
) : MessageEntity, TextSource by BoldTextSource(sourceString)
|
||||
|
@ -1,19 +1,16 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.BotCommandTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.commandHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.commandMarkdown
|
||||
|
||||
private val commandRegex = Regex("[/!][^@\\s]*")
|
||||
|
||||
data class BotCommandMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.commandMarkdown()
|
||||
override val asHtmlSource: String = sourceString.commandHTML()
|
||||
|
||||
val command: String by lazy {
|
||||
commandRegex.find(sourceString) ?.value ?.substring(1) ?: sourceString.substring(1)// skip first symbol like "/" or "!"
|
||||
}
|
||||
override val sourceString: String,
|
||||
private val botCommandTextSource: BotCommandTextSource = BotCommandTextSource(sourceString)
|
||||
) : MessageEntity, TextSource by botCommandTextSource {
|
||||
val command: String
|
||||
get() = botCommandTextSource.command
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.CodeTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.codeHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.codeMarkdown
|
||||
|
||||
@ -7,7 +9,4 @@ data class CodeTextMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.codeMarkdown()
|
||||
override val asHtmlSource: String = sourceString.codeHTML()
|
||||
}
|
||||
) : MessageEntity, TextSource by CodeTextSource(sourceString)
|
||||
|
@ -1,13 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.EMailTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.emailHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.emailMarkdown
|
||||
|
||||
class EMailMessageEntity(
|
||||
data class EMailMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.emailMarkdown()
|
||||
override val asHtmlSource: String = sourceString.emailHTML()
|
||||
}
|
||||
) : MessageEntity, TextSource by EMailTextSource(sourceString)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.HashTagTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.hashTagHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.hashTagMarkdown
|
||||
|
||||
@ -7,7 +9,4 @@ data class HashTagMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.hashTagMarkdown()
|
||||
override val asHtmlSource: String = sourceString.hashTagHTML()
|
||||
}
|
||||
) : MessageEntity, TextSource by HashTagTextSource(sourceString)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.ItalicTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.italicHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.italicMarkdown
|
||||
|
||||
@ -7,7 +9,4 @@ data class ItalicTextMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.italicMarkdown()
|
||||
override val asHtmlSource: String = sourceString.italicHTML()
|
||||
}
|
||||
) : MessageEntity, TextSource by ItalicTextSource(sourceString)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.MentionTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionMarkdown
|
||||
|
||||
@ -7,7 +9,4 @@ class MentionMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.mentionMarkdown()
|
||||
override val asHtmlSource: String = sourceString.mentionHTML()
|
||||
}
|
||||
) : MessageEntity, TextSource by MentionTextSource(sourceString)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.PhoneNumberTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.phoneHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.phoneMarkdown
|
||||
|
||||
@ -7,7 +9,4 @@ data class PhoneNumberMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.phoneMarkdown()
|
||||
override val asHtmlSource: String = sourceString.phoneHTML()
|
||||
}
|
||||
) : MessageEntity, TextSource by PhoneNumberTextSource(sourceString)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.PreTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.preHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.preMarkdown
|
||||
|
||||
@ -7,7 +9,4 @@ data class PreTextMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.preMarkdown()
|
||||
override val asHtmlSource: String = sourceString.preHTML()
|
||||
}
|
||||
) : MessageEntity, TextSource by PreTextSource(sourceString)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.RegularTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.toHtml
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.toMarkdown
|
||||
|
||||
@ -7,7 +9,4 @@ data class RegularTextMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.toMarkdown()
|
||||
override val asHtmlSource: String = sourceString.toHtml()
|
||||
}
|
||||
) : MessageEntity, TextSource by RegularTextSource(sourceString)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.TextLinkTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.linkHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.linkMarkdown
|
||||
|
||||
@ -8,7 +10,4 @@ data class TextLinkMessageEntity(
|
||||
override val length: Int,
|
||||
override val sourceString: String,
|
||||
val url: String
|
||||
) : MessageEntity {
|
||||
override val asMarkdownSource: String = sourceString.linkMarkdown(url)
|
||||
override val asHtmlSource: String = sourceString.linkHTML(url)
|
||||
}
|
||||
) : MessageEntity, TextSource by TextLinkTextSource(sourceString, url)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.TextMentionTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionHTML
|
||||
@ -10,7 +12,7 @@ class TextMentionMessageEntity(
|
||||
override val length: Int,
|
||||
override val sourceString: String,
|
||||
val privateChat: PrivateChat
|
||||
) : MessageEntity {
|
||||
) : MessageEntity, TextSource by TextMentionTextSource(sourceString, privateChat) {
|
||||
@Deprecated("Deprecated due to the fact that there is more common constructor")
|
||||
constructor(
|
||||
offset: Int,
|
||||
@ -18,7 +20,4 @@ class TextMentionMessageEntity(
|
||||
sourceString: String,
|
||||
user: User
|
||||
) : this(offset, length, sourceString, user as PrivateChat)
|
||||
|
||||
override val asMarkdownSource: String = sourceString.mentionMarkdown(privateChat.id)
|
||||
override val asHtmlSource: String = sourceString.mentionHTML(privateChat.id)
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.URLTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.linkHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.linkMarkdown
|
||||
|
||||
@ -7,9 +9,6 @@ data class URLMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
override val sourceString: String
|
||||
) : MessageEntity{
|
||||
) : MessageEntity, TextSource by URLTextSource(sourceString) {
|
||||
val url: String = sourceString
|
||||
|
||||
override val asMarkdownSource: String = sourceString.linkMarkdown(url)
|
||||
override val asHtmlSource: String = sourceString.linkHTML(url)
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.boldHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.boldMarkdown
|
||||
|
||||
class BoldTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.boldMarkdown()
|
||||
override val asHtmlSource: String = sourceString.boldHTML()
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.commandHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.commandMarkdown
|
||||
|
||||
private val commandRegex = Regex("[/!][^@\\s]*")
|
||||
|
||||
class BotCommandTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.commandMarkdown()
|
||||
override val asHtmlSource: String = sourceString.commandHTML()
|
||||
|
||||
val command: String by lazy {
|
||||
commandRegex.find(sourceString) ?.value ?.substring(1) ?: sourceString.substring(1)// skip first symbol like "/" or "!"
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.codeHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.codeMarkdown
|
||||
|
||||
class CodeTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.codeMarkdown()
|
||||
override val asHtmlSource: String = sourceString.codeHTML()
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.emailHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.emailMarkdown
|
||||
|
||||
class EMailTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.emailMarkdown()
|
||||
override val asHtmlSource: String = sourceString.emailHTML()
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.hashTagHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.hashTagMarkdown
|
||||
|
||||
class HashTagTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.hashTagMarkdown()
|
||||
override val asHtmlSource: String = sourceString.hashTagHTML()
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.italicHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.italicMarkdown
|
||||
|
||||
class ItalicTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.italicMarkdown()
|
||||
override val asHtmlSource: String = sourceString.italicHTML()
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionMarkdown
|
||||
|
||||
class MentionTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.mentionMarkdown()
|
||||
override val asHtmlSource: String = sourceString.mentionHTML()
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.phoneHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.phoneMarkdown
|
||||
|
||||
class PhoneNumberTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.phoneMarkdown()
|
||||
override val asHtmlSource: String = sourceString.phoneHTML()
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.preHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.preMarkdown
|
||||
|
||||
class PreTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.preMarkdown()
|
||||
override val asHtmlSource: String = sourceString.preHTML()
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.toHtml
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.toMarkdown
|
||||
|
||||
class RegularTextSource(
|
||||
sourceString: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.toMarkdown()
|
||||
override val asHtmlSource: String = sourceString.toHtml()
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.linkHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.linkMarkdown
|
||||
|
||||
class TextLinkTextSource(
|
||||
sourceString: String,
|
||||
url: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String = sourceString.linkMarkdown(url)
|
||||
override val asHtmlSource: String = sourceString.linkHTML(url)
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.mentionMarkdown
|
||||
|
||||
class TextMentionTextSource(
|
||||
sourceString: String,
|
||||
privateChat: PrivateChat
|
||||
) : TextSource {
|
||||
@Deprecated("Deprecated due to the fact that there is more common constructor")
|
||||
constructor(
|
||||
sourceString: String,
|
||||
user: User
|
||||
) : this(sourceString, user as PrivateChat)
|
||||
|
||||
override val asMarkdownSource: String = sourceString.mentionMarkdown(privateChat.id)
|
||||
override val asHtmlSource: String = sourceString.mentionHTML(privateChat.id)
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.linkHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.linkMarkdown
|
||||
|
||||
class URLTextSource(
|
||||
sourceString: String
|
||||
) : TextSource{
|
||||
override val asMarkdownSource: String = sourceString.linkMarkdown(sourceString)
|
||||
override val asHtmlSource: String = sourceString.linkHTML(sourceString)
|
||||
}
|
Loading…
Reference in New Issue
Block a user