mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
experimentally make source string available inside of text sources
This commit is contained in:
parent
cf9f270651
commit
7183634fd6
@ -42,6 +42,7 @@
|
||||
|
||||
* `TelegramBotAPI`:
|
||||
* Now `EditMediaGroupUpdate` also extends `BaseEditMessageUpdate`
|
||||
* **EXPERIMENTALLY** Now all `TextSource` realisations will contain `source` field as a property inside of them
|
||||
* `TelegramBotAPI-extensions-api`:
|
||||
* `startGettingFlowsUpdates` extension which do not require filter (but return a new one) was added
|
||||
* `TelegramBotAPI-extensions-utils`:
|
||||
|
@ -4,6 +4,7 @@ interface TextSource {
|
||||
val asMarkdownSource: String
|
||||
val asMarkdownV2Source: String
|
||||
val asHtmlSource: String
|
||||
val source: String
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class BoldTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
|
||||
|
@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
private val commandRegex = Regex("[/!][^@\\s]*")
|
||||
|
||||
class BotCommandTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
val command: String by lazy {
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class CashTagTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
|
||||
|
@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class CodeTextSource(
|
||||
source: String
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String by lazy { source.codeMarkdown() }
|
||||
override val asMarkdownV2Source: String by lazy { source.codeMarkdownV2() }
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class EMailTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
|
||||
|
@ -12,7 +12,7 @@ private val String.withoutSharp
|
||||
}
|
||||
|
||||
class HashTagTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy {
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class ItalicTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
|
||||
|
@ -12,7 +12,7 @@ private val String.withoutCommercialAt
|
||||
}
|
||||
|
||||
class MentionTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy {
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class PhoneNumberTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
|
||||
|
@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class PreTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
val language: String? = null
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String by lazy { source.preMarkdown(language) }
|
||||
|
@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class RegularTextSource(
|
||||
source: String
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String by lazy { source.regularMarkdown() }
|
||||
override val asMarkdownV2Source: String by lazy { source.regularMarkdownV2() }
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class StrikethroughTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
|
||||
|
@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class TextLinkTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
url: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String by lazy { source.linkMarkdown(url) }
|
||||
|
@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateCh
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class TextMentionTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
privateChat: PrivateChat,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
|
@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class URLTextSource(
|
||||
source: String
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
override val asMarkdownSource: String by lazy { source.linkMarkdown(source) }
|
||||
override val asMarkdownV2Source: String by lazy { source.linkMarkdownV2(source) }
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||
|
||||
class UnderlineTextSource(
|
||||
source: String,
|
||||
override val source: String,
|
||||
textParts: List<TextPart>
|
||||
) : MultilevelTextSource {
|
||||
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
|
||||
|
Loading…
Reference in New Issue
Block a user