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