From c2032d21cd9fd96fcf7cb6c4578ce169413750c3 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 16 Nov 2020 13:32:20 +0600 Subject: [PATCH] TextSource properties has been renamed --- CHANGELOG.md | 6 ++++++ .../inmo/tgbotapi/CommonAbstracts/TextSource.kt | 16 +++++++++++++--- .../MessageEntity/textsources/BoldTextSource.kt | 6 +++--- .../textsources/BotCommandTextSource.kt | 6 +++--- .../textsources/CashTagTextSource.kt | 6 +++--- .../MessageEntity/textsources/CodeTextSource.kt | 6 +++--- .../MessageEntity/textsources/EMailTextSource.kt | 6 +++--- .../textsources/HashTagTextSource.kt | 6 +++--- .../textsources/ItalicTextSource.kt | 6 +++--- .../textsources/MentionTextSource.kt | 6 +++--- .../textsources/PhoneNumberTextSource.kt | 6 +++--- .../MessageEntity/textsources/PreTextSource.kt | 6 +++--- .../textsources/RegularTextSource.kt | 6 +++--- .../textsources/StrikethroughTextSource.kt | 6 +++--- .../textsources/TextLinkTextSource.kt | 6 +++--- .../textsources/TextMentionTextSource.kt | 6 +++--- .../MessageEntity/textsources/URLTextSource.kt | 6 +++--- .../textsources/UnderlineTextSource.kt | 6 +++--- .../internal/CaptionAndTextSourcesToText.kt | 6 +++--- .../internal/MultilevelTextSourceFormatting.kt | 4 ++-- .../utils/formatting/LinksFormatting.kt | 7 +++---- .../utils/formatting/ResendingTextFormatting.kt | 6 +++--- 22 files changed, 78 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f34555d3a0..a69be49063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## 0.30.6 +* `Core` + * `TextSource` properties has been renamed: + * `asMarkdownSource` -> `markdown` + * `asMarkdownV2Source` -> `markdownV2` + * `asHtmlSource` -> `html` + ## 0.30.5 * `Common`: diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt index 6f067adeff..08f70a5041 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt @@ -14,13 +14,23 @@ typealias FullTextSourcesList = List typealias FullTextPartsList = List interface TextSource { - val asMarkdownSource: String - val asMarkdownV2Source: String - val asHtmlSource: String + val markdown: String + val markdownV2: String + val html: String val source: String val asText: String get() = source + + @Deprecated("Rename", ReplaceWith("markdown")) + val asMarkdownSource: String + get() = markdown + @Deprecated("Rename", ReplaceWith("markdownV2")) + val asMarkdownV2Source: String + get() = markdownV2 + @Deprecated("Rename", ReplaceWith("html")) + val asHtmlSource: String + get() = html } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt index d5098f72f0..d4a05a7bc4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt @@ -13,9 +13,9 @@ data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.boldMarkdown() } - override val asMarkdownV2Source: String by lazy { boldMarkdownV2() } - override val asHtmlSource: String by lazy { boldHTML() } + override val markdown: String by lazy { source.boldMarkdown() } + override val markdownV2: String by lazy { boldMarkdownV2() } + override val html: String by lazy { boldHTML() } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BotCommandTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BotCommandTextSource.kt index 8ca260ddf2..1923aa88bc 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BotCommandTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BotCommandTextSource.kt @@ -18,9 +18,9 @@ data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstru commandRegex.find(source) ?.value ?.substring(1) ?: source.substring(1)// skip first symbol like "/" or "!" } - override val asMarkdownSource: String by lazy { source.commandMarkdown() } - override val asMarkdownV2Source: String by lazy { source.commandMarkdownV2() } - override val asHtmlSource: String by lazy { source.commandHTML() } + override val markdown: String by lazy { source.commandMarkdown() } + override val markdownV2: String by lazy { source.commandMarkdownV2() } + override val html: String by lazy { source.commandHTML() } } /** diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CashTagTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CashTagTextSource.kt index 5b016c0fd1..4fa504f5ce 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CashTagTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CashTagTextSource.kt @@ -13,9 +13,9 @@ data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.cashTagMarkdown() } - override val asMarkdownV2Source: String by lazy { cashTagMarkdownV2() } - override val asHtmlSource: String by lazy { cashTagHTML() } + override val markdown: String by lazy { source.cashTagMarkdown() } + override val markdownV2: String by lazy { cashTagMarkdownV2() } + override val html: String by lazy { cashTagHTML() } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CodeTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CodeTextSource.kt index 86d4aae7cd..7935f01fc3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CodeTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CodeTextSource.kt @@ -13,9 +13,9 @@ import dev.inmo.tgbotapi.utils.internal.codeMarkdownV2 data class CodeTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String ) : TextSource { - override val asMarkdownSource: String by lazy { source.codeMarkdown() } - override val asMarkdownV2Source: String by lazy { source.codeMarkdownV2() } - override val asHtmlSource: String by lazy { source.codeHTML() } + override val markdown: String by lazy { source.codeMarkdown() } + override val markdownV2: String by lazy { source.codeMarkdownV2() } + override val html: String by lazy { source.codeHTML() } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/EMailTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/EMailTextSource.kt index 850cbefcd9..6de5d3ddce 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/EMailTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/EMailTextSource.kt @@ -13,9 +13,9 @@ data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.emailMarkdown() } - override val asMarkdownV2Source: String by lazy { emailMarkdownV2(source) } - override val asHtmlSource: String by lazy { emailHTML(source) } + override val markdown: String by lazy { source.emailMarkdown() } + override val markdownV2: String by lazy { emailMarkdownV2(source) } + override val html: String by lazy { emailHTML(source) } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/HashTagTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/HashTagTextSource.kt index 04af45a2e3..109ef54cbc 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/HashTagTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/HashTagTextSource.kt @@ -13,9 +13,9 @@ data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.hashTagMarkdown() } - override val asMarkdownV2Source: String by lazy { hashTagMarkdownV2() } - override val asHtmlSource: String by lazy { hashTagHTML() } + override val markdown: String by lazy { source.hashTagMarkdown() } + override val markdownV2: String by lazy { hashTagMarkdownV2() } + override val html: String by lazy { hashTagHTML() } init { if (!source.startsWith("#")) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/ItalicTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/ItalicTextSource.kt index 870fc8c7fc..92e71013c6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/ItalicTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/ItalicTextSource.kt @@ -13,9 +13,9 @@ data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.italicMarkdown() } - override val asMarkdownV2Source: String by lazy { italicMarkdownV2() } - override val asHtmlSource: String by lazy { italicHTML() } + override val markdown: String by lazy { source.italicMarkdown() } + override val markdownV2: String by lazy { italicMarkdownV2() } + override val html: String by lazy { italicHTML() } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt index f56ca0a13e..421c89c7a3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt @@ -20,9 +20,9 @@ data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.mentionMarkdown() } - override val asMarkdownV2Source: String by lazy { mentionMarkdownV2() } - override val asHtmlSource: String by lazy { mentionHTML() } + override val markdown: String by lazy { source.mentionMarkdown() } + override val markdownV2: String by lazy { mentionMarkdownV2() } + override val html: String by lazy { mentionHTML() } init { if (!source.startsWith("@")) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PhoneNumberTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PhoneNumberTextSource.kt index c6950f0889..ea3bb8feae 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PhoneNumberTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PhoneNumberTextSource.kt @@ -13,9 +13,9 @@ data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstr override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.phoneMarkdown() } - override val asMarkdownV2Source: String by lazy { phoneMarkdownV2() } - override val asHtmlSource: String by lazy { phoneHTML() } + override val markdown: String by lazy { source.phoneMarkdown() } + override val markdownV2: String by lazy { phoneMarkdownV2() } + override val html: String by lazy { phoneHTML() } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PreTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PreTextSource.kt index 8ec55f8deb..4c001f5387 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PreTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PreTextSource.kt @@ -13,9 +13,9 @@ data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) c override val source: String, val language: String? = null ) : TextSource { - override val asMarkdownSource: String by lazy { source.preMarkdown(language) } - override val asMarkdownV2Source: String by lazy { source.preMarkdownV2(language) } - override val asHtmlSource: String by lazy { source.preHTML(language) } + override val markdown: String by lazy { source.preMarkdown(language) } + override val markdownV2: String by lazy { source.preMarkdownV2(language) } + override val html: String by lazy { source.preHTML(language) } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/RegularTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/RegularTextSource.kt index d70f3d1129..1d78129ca6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/RegularTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/RegularTextSource.kt @@ -12,9 +12,9 @@ import dev.inmo.tgbotapi.utils.internal.regularMarkdownV2 data class RegularTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String ) : TextSource { - override val asMarkdownSource: String by lazy { source.regularMarkdown() } - override val asMarkdownV2Source: String by lazy { source.regularMarkdownV2() } - override val asHtmlSource: String by lazy { source.regularHtml() } + override val markdown: String by lazy { source.regularMarkdown() } + override val markdownV2: String by lazy { source.regularMarkdownV2() } + override val html: String by lazy { source.regularHtml() } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/StrikethroughTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/StrikethroughTextSource.kt index 58e8e18dbd..a1557d1b88 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/StrikethroughTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/StrikethroughTextSource.kt @@ -13,9 +13,9 @@ data class StrikethroughTextSource @RiskFeature(DirectInvocationOfTextSourceCons override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asHtmlSource: String by lazy { strikethroughHTML() } - override val asMarkdownV2Source: String by lazy { strikethroughMarkdownV2() } - override val asMarkdownSource: String by lazy { source.strikethroughMarkdown() } + override val html: String by lazy { strikethroughHTML() } + override val markdownV2: String by lazy { strikethroughMarkdownV2() } + override val markdown: String by lazy { source.strikethroughMarkdown() } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextLinkTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextLinkTextSource.kt index c0e3098dba..482fb7dcbc 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextLinkTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextLinkTextSource.kt @@ -13,9 +13,9 @@ data class TextLinkTextSource @RiskFeature(DirectInvocationOfTextSourceConstruct override val source: String, val url: String ) : TextSource { - override val asMarkdownSource: String by lazy { source.linkMarkdown(url) } - override val asMarkdownV2Source: String by lazy { source.linkMarkdownV2(url) } - override val asHtmlSource: String by lazy { source.linkHTML(url) } + 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) } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextMentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextMentionTextSource.kt index acf2902cfa..8fd7a50521 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextMentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextMentionTextSource.kt @@ -15,9 +15,9 @@ data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstr val user: User, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.textMentionMarkdown(user.id) } - override val asMarkdownV2Source: String by lazy { textMentionMarkdownV2(user.id) } - override val asHtmlSource: String by lazy { textMentionHTML(user.id) } + override val markdown: String by lazy { source.textMentionMarkdown(user.id) } + override val markdownV2: String by lazy { textMentionMarkdownV2(user.id) } + override val html: String by lazy { textMentionHTML(user.id) } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/URLTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/URLTextSource.kt index 4a5fb0825b..c2cad771c6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/URLTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/URLTextSource.kt @@ -12,9 +12,9 @@ import dev.inmo.tgbotapi.utils.internal.linkMarkdownV2 data class URLTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String ) : TextSource { - override val asMarkdownSource: String by lazy { source.linkMarkdown(source) } - override val asMarkdownV2Source: String by lazy { source.linkMarkdownV2(source) } - override val asHtmlSource: String by lazy { source.linkHTML(source) } + override val markdown: String by lazy { source.linkMarkdown(source) } + override val markdownV2: String by lazy { source.linkMarkdownV2(source) } + override val html: String by lazy { source.linkHTML(source) } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/UnderlineTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/UnderlineTextSource.kt index db6dd52efa..4a7a799fdb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/UnderlineTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/UnderlineTextSource.kt @@ -13,9 +13,9 @@ data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstruc override val source: String, override val subsources: List ) : MultilevelTextSource { - override val asMarkdownSource: String by lazy { source.underlineMarkdown() } - override val asMarkdownV2Source: String by lazy { underlineMarkdownV2() } - override val asHtmlSource: String by lazy { underlineHTML() } + override val markdown: String by lazy { source.underlineMarkdown() } + override val markdownV2: String by lazy { underlineMarkdownV2() } + override val html: String by lazy { underlineHTML() } } @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/CaptionAndTextSourcesToText.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/CaptionAndTextSourcesToText.kt index a1c9d049af..5502e2e29a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/CaptionAndTextSourcesToText.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/CaptionAndTextSourcesToText.kt @@ -15,9 +15,9 @@ internal fun createFormattedText( val textBuilder = StringBuilder(partLength) for (entity in entities) { val string = when (mode) { - is MarkdownParseMode -> entity.asMarkdownSource - is MarkdownV2ParseMode -> entity.asMarkdownV2Source - is HTMLParseMode -> entity.asHtmlSource + is MarkdownParseMode -> entity.markdown + is MarkdownV2ParseMode -> entity.markdownV2 + is HTMLParseMode -> entity.html } if (textBuilder.length + string.length > partLength) { if (textBuilder.isNotEmpty()) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/MultilevelTextSourceFormatting.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/MultilevelTextSourceFormatting.kt index 31ef7e5136..ec8cf5ab7c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/MultilevelTextSourceFormatting.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/MultilevelTextSourceFormatting.kt @@ -73,11 +73,11 @@ internal fun List.shiftSourcesToTheLeft(shiftCount: Int = 1): List.joinSubSourcesMarkdownV2() = joinToString("") { - it.asMarkdownV2Source + it.markdownV2 } private fun List.joinSubSourcesHtml() = joinToString("") { - it.asHtmlSource + it.html } internal fun MultilevelTextSource.markdownV2Default( diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt index d02ed27b8a..b05579fde5 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt @@ -4,7 +4,6 @@ import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.textsources.link import dev.inmo.tgbotapi.types.ParseMode.* import dev.inmo.tgbotapi.types.chat.abstracts.* -import dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat import dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedPublicChat import dev.inmo.tgbotapi.types.message.abstracts.Message @@ -92,17 +91,17 @@ val StickerSetName.stickerSetLink @Deprecated("Use extension `stickerSetLink` + getting of `asMarkdownV2Source` property") fun makeLinkToAddStickerSetInMarkdownV2( stickerSetName: StickerSetName -) = stickerSetName.stickerSetLink.asMarkdownV2Source +) = stickerSetName.stickerSetLink.markdownV2 /** * @return Link for adding of sticker set with name [stickerSetName] with formatting for [Markdown] */ @Deprecated("Use extension `stickerSetLink` + getting of `asMarkdownSource` property") -fun makeLinkToAddStickerSetInMarkdown(stickerSetName: StickerSetName) = stickerSetName.stickerSetLink.asMarkdownSource +fun makeLinkToAddStickerSetInMarkdown(stickerSetName: StickerSetName) = stickerSetName.stickerSetLink.markdown /** * @return Link for adding of sticker set with name [stickerSetName] with formatting for [HTML] */ @Deprecated("Use extension `stickerSetLink` + getting of `asHtmlSource` property") -fun makeLinkToAddStickerSetInHtml(stickerSetName: StickerSetName) = stickerSetName.stickerSetLink.asHtmlSource +fun makeLinkToAddStickerSetInHtml(stickerSetName: StickerSetName) = stickerSetName.stickerSetLink.html /** * Create a link for adding of sticker set with name [stickerSetName]. Was added thanks to user Djaler and based on * https://github.com/Djaler/evil-bot/blob/master/src/main/kotlin/com/github/djaler/evilbot/utils/StickerUtils.kt#L6-L8 diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/ResendingTextFormatting.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/ResendingTextFormatting.kt index a459574b13..ab62b4f1aa 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/ResendingTextFormatting.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/ResendingTextFormatting.kt @@ -15,9 +15,9 @@ fun createFormattedText( val textBuilder = StringBuilder(partLength) for (entity in entities) { val string = when (mode) { - is MarkdownParseMode -> entity.asMarkdownSource - is MarkdownV2ParseMode -> entity.asMarkdownV2Source - is HTMLParseMode -> entity.asHtmlSource + is MarkdownParseMode -> entity.markdown + is MarkdownV2ParseMode -> entity.markdownV2 + is HTMLParseMode -> entity.html } if (textBuilder.length + string.length > partLength) { if (textBuilder.isNotEmpty()) {