From adaedb8040cc84ed28578f05837017849f4d3268 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 19 Dec 2024 16:31:42 +0600 Subject: [PATCH] text sources factories renames --- .../ktor/base/AbstractRequestCallFactory.kt | 3 - .../types/message/RawMessageEntity.kt | 7 +- .../textsources/BlockquoteTextSource.kt | 8 +- .../message/textsources/BoldTextSource.kt | 8 +- .../textsources/BotCommandTextSource.kt | 6 +- .../message/textsources/CashTagTextSource.kt | 8 +- .../message/textsources/CodeTextSource.kt | 4 +- .../textsources/CustomEmojiTextSource.kt | 8 +- .../message/textsources/EMailTextSource.kt | 8 +- .../ExpandableBlockquoteTextSource.kt | 8 +- .../message/textsources/HashTagTextSource.kt | 8 +- .../message/textsources/ItalicTextSource.kt | 8 +- .../message/textsources/MentionTextSource.kt | 10 +- .../textsources/PhoneNumberTextSource.kt | 8 +- .../message/textsources/PreTextSource.kt | 4 +- .../message/textsources/RegularTextSource.kt | 6 +- .../message/textsources/SpoilerTextSource.kt | 8 +- .../textsources/StrikethroughTextSource.kt | 2 +- .../message/textsources/TextLinkTextSource.kt | 4 +- .../textsources/TextMentionTextSource.kt | 28 +- .../types/message/textsources/TextSource.kt | 4 +- .../message/textsources/URLTextSource.kt | 4 +- .../textsources/UnderlineTextSource.kt | 8 +- .../inmo/tgbotapi/utils/EntitiesBuilder.kt | 246 +++++++++--------- .../MessageEntity/StringFormattingTests.kt | 16 +- .../utils/formatting/LinksFormatting.kt | 4 +- 26 files changed, 215 insertions(+), 221 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory.kt index ee90d69256..e9c849bba4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory.kt @@ -9,17 +9,14 @@ import dev.inmo.tgbotapi.bot.exceptions.newRequestException import dev.inmo.tgbotapi.requests.GetUpdatesRequest import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.types.Response -import dev.inmo.tgbotapi.types.message.textsources.pre import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper import io.ktor.client.HttpClient import io.ktor.client.plugins.timeout import io.ktor.client.request.* -import io.ktor.client.request.forms.* import io.ktor.client.statement.bodyAsText import io.ktor.http.ContentType import io.ktor.http.content.* -import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json import kotlin.collections.set diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessageEntity.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessageEntity.kt index efa44a9494..5fbfc20e32 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessageEntity.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessageEntity.kt @@ -1,13 +1,10 @@ package dev.inmo.tgbotapi.types.message import dev.inmo.micro_utils.common.Warning -import dev.inmo.micro_utils.serialization.mapper.MapperSerializer import dev.inmo.tgbotapi.types.CustomEmojiId import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.message.textsources.* -import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializable -import kotlinx.serialization.builtins.ListSerializer @Serializable @Warning("This thing is subject of changes. Library do not guarantee stability of this class") @@ -102,7 +99,7 @@ internal fun List>.fillWithRegulars(source: String): TextS for (i in indices) { val (offset, textSource) = get(i) if (offset - index > 0) { - result.add(regular(source.substring(index, offset))) + result.add(regularTextSource(source.substring(index, offset))) index = offset } result.add(textSource) @@ -110,7 +107,7 @@ internal fun List>.fillWithRegulars(source: String): TextS } if (index != source.length) { - result.add(regular(source.substring(index, source.length))) + result.add(regularTextSource(source.substring(index, source.length))) } return result diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BlockquoteTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BlockquoteTextSource.kt index 251795d3f8..427a2a5d3a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BlockquoteTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BlockquoteTextSource.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see blockquote + * @see blockquoteTextSource */ @Serializable data class BlockquoteTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -18,6 +18,6 @@ data class BlockquoteTextSource @RiskFeature(DirectInvocationOfTextSourceConstru override val html: String by lazy { blockquoteHTML() } } -inline fun blockquote(parts: TextSourcesList) = BlockquoteTextSource(parts.makeString(), parts) -inline fun blockquote(vararg parts: TextSource) = blockquote(parts.toList()) -inline fun blockquote(text: String) = blockquote(regular(text)) +inline fun blockquoteTextSource(parts: TextSourcesList) = BlockquoteTextSource(parts.makeString(), parts) +inline fun blockquoteTextSource(vararg parts: TextSource) = blockquoteTextSource(parts.toList()) +inline fun blockquoteTextSource(text: String) = blockquoteTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BoldTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BoldTextSource.kt index fa6cdf91c7..716d45dcd6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BoldTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BoldTextSource.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see bold + * @see boldTextSource */ @Serializable data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -18,6 +18,6 @@ data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { boldHTML() } } -inline fun bold(parts: TextSourcesList) = BoldTextSource(parts.makeString(), parts) -inline fun bold(vararg parts: TextSource) = bold(parts.toList()) -inline fun bold(text: String) = bold(regular(text)) +inline fun boldTextSource(parts: TextSourcesList) = BoldTextSource(parts.makeString(), parts) +inline fun boldTextSource(vararg parts: TextSource) = boldTextSource(parts.toList()) +inline fun boldTextSource(text: String) = boldTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt index a58154ac46..3b1572ee84 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt @@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see botCommand + * @see botCommandTextSource */ @Serializable data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -33,6 +33,6 @@ data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstru /** * @param command Without leading "/" */ -inline fun botCommand(command: String) = BotCommandTextSource("/$command") +inline fun botCommandTextSource(command: String) = BotCommandTextSource("/$command") -inline fun botCommand(botCommand: BotCommand) = botCommand(botCommand.command) +inline fun botCommandTextSource(botCommand: BotCommand) = botCommandTextSource(botCommand.command) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CashTagTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CashTagTextSource.kt index a29cc6a629..766ee82a46 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CashTagTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CashTagTextSource.kt @@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see cashTag + * @see cashTagTextSource */ @Serializable data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -25,6 +25,6 @@ data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { cashTagHTML() } } -inline fun cashTag(parts: TextSourcesList) = CashTagTextSource(parts.makeString(), parts) -inline fun cashTag(vararg parts: TextSource) = cashTag(parts.toList()) -inline fun cashTag(tag: String) = cashTag(regular(tag)) +inline fun cashTagTextSource(parts: TextSourcesList) = CashTagTextSource(parts.makeString(), parts) +inline fun cashTagTextSource(vararg parts: TextSource) = cashTagTextSource(parts.toList()) +inline fun cashTagTextSource(tag: String) = cashTagTextSource(regularTextSource(tag)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CodeTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CodeTextSource.kt index aab08039e7..04ce61ed69 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CodeTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CodeTextSource.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see code + * @see codeTextSource */ @Serializable data class CodeTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -16,4 +16,4 @@ data class CodeTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { source.codeHTML() } } -inline fun code(code: String) = CodeTextSource(code) +inline fun codeTextSource(code: String) = CodeTextSource(code) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CustomEmojiTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CustomEmojiTextSource.kt index 13adb22689..13f739cbbf 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CustomEmojiTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CustomEmojiTextSource.kt @@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see customEmoji + * @see customEmojiTextSource */ @Serializable data class CustomEmojiTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -21,9 +21,9 @@ data class CustomEmojiTextSource @RiskFeature(DirectInvocationOfTextSourceConstr } @Suppress("EXPERIMENTAL_API_USAGE") -inline fun customEmoji(emojiId: CustomEmojiId, parts: TextSourcesList) = CustomEmojiTextSource(parts.makeString(), emojiId, parts) -inline fun customEmoji(emojiId: CustomEmojiId, vararg parts: TextSource) = customEmoji(emojiId, parts.toList()) +inline fun customEmojiTextSource(emojiId: CustomEmojiId, parts: TextSourcesList) = CustomEmojiTextSource(parts.makeString(), emojiId, parts) +inline fun customEmojiTextSource(emojiId: CustomEmojiId, vararg parts: TextSource) = customEmojiTextSource(emojiId, parts.toList()) /** * Without sharp (#) */ -inline fun customEmoji(emojiId: CustomEmojiId, text: String) = customEmoji(emojiId, regular(text)) +inline fun customEmojiTextSource(emojiId: CustomEmojiId, text: String) = customEmojiTextSource(emojiId, regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/EMailTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/EMailTextSource.kt index 59a94e0917..b030545713 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/EMailTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/EMailTextSource.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see email + * @see emailTextSource */ @Serializable data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -18,6 +18,6 @@ data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { emailHTML(source) } } -inline fun email(parts: TextSourcesList) = EMailTextSource(parts.makeString(), parts) -inline fun email(vararg parts: TextSource) = email(parts.toList()) -inline fun email(emailAddress: String) = email(regular(emailAddress)) +inline fun emailTextSource(parts: TextSourcesList) = EMailTextSource(parts.makeString(), parts) +inline fun emailTextSource(vararg parts: TextSource) = emailTextSource(parts.toList()) +inline fun emailTextSource(emailAddress: String) = emailTextSource(regularTextSource(emailAddress)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource.kt index 0cfb17b152..c4d6c1e677 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see expandableBlockquote + * @see expandableBlockquoteTextSource */ @Serializable data class ExpandableBlockquoteTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -18,6 +18,6 @@ data class ExpandableBlockquoteTextSource @RiskFeature(DirectInvocationOfTextSou override val html: String by lazy { expandableBlockquoteHTML() } } -inline fun expandableBlockquote(parts: TextSourcesList) = ExpandableBlockquoteTextSource(parts.makeString(), parts) -inline fun expandableBlockquote(vararg parts: TextSource) = expandableBlockquote(parts.toList()) -inline fun expandableBlockquote(text: String) = expandableBlockquote(regular(text)) +inline fun expandableBlockquoteTextSource(parts: TextSourcesList) = ExpandableBlockquoteTextSource(parts.makeString(), parts) +inline fun expandableBlockquoteTextSource(vararg parts: TextSource) = expandableBlockquoteTextSource(parts.toList()) +inline fun expandableBlockquoteTextSource(text: String) = expandableBlockquoteTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/HashTagTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/HashTagTextSource.kt index ae53aea509..0bb98715e1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/HashTagTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/HashTagTextSource.kt @@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see hashtag + * @see hashtagTextSource */ @Serializable data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -33,9 +33,9 @@ data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } @Suppress("EXPERIMENTAL_API_USAGE") -inline fun hashtag(parts: TextSourcesList) = (regular("#") + parts).let { HashTagTextSource(it.makeString(), it) } -inline fun hashtag(vararg parts: TextSource) = hashtag(parts.toList()) +inline fun hashtagTextSource(parts: TextSourcesList) = (regularTextSource("#") + parts).let { HashTagTextSource(it.makeString(), it) } +inline fun hashtagTextSource(vararg parts: TextSource) = hashtagTextSource(parts.toList()) /** * Without sharp (#) */ -inline fun hashtag(hashtag: String) = hashtag(regular(hashtag)) +inline fun hashtagTextSource(hashtag: String) = hashtagTextSource(regularTextSource(hashtag)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ItalicTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ItalicTextSource.kt index 0deddc83c7..5bcd64c95a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ItalicTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ItalicTextSource.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see italic + * @see italicTextSource */ @Serializable data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -18,7 +18,7 @@ data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor override val html: String by lazy { italicHTML() } } -inline fun italic(parts: TextSourcesList) = ItalicTextSource(parts.makeString(), parts) -inline fun italic(vararg parts: TextSource) = italic(parts.toList()) -inline fun italic(text: String) = italic(regular(text)) +inline fun italicTextSource(parts: TextSourcesList) = ItalicTextSource(parts.makeString(), parts) +inline fun italicTextSource(vararg parts: TextSource) = italicTextSource(parts.toList()) +inline fun italicTextSource(text: String) = italicTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/MentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/MentionTextSource.kt index 17e39b6f50..5184155442 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/MentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/MentionTextSource.kt @@ -14,7 +14,7 @@ private val String.withoutCommercialAt } /** - * @see mention + * @see mentionTextSource */ @Serializable data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -33,13 +33,13 @@ data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } } -inline fun mention(parts: TextSourcesList) = (regular("@") + parts).let { MentionTextSource(it.makeString(), it) } -inline fun mention(vararg parts: TextSource) = mention(parts.toList()) +inline fun mentionTextSource(parts: TextSourcesList) = (regularTextSource("@") + parts).let { MentionTextSource(it.makeString(), it) } +inline fun mentionTextSource(vararg parts: TextSource) = mentionTextSource(parts.toList()) /** * Without leading "@" */ -inline fun mention(whoToMention: String) = mention(regular(whoToMention)) +inline fun mentionTextSource(whoToMention: String) = mentionTextSource(regularTextSource(whoToMention)) -inline fun mention(whoToMention: Username) = mention(whoToMention.full.dropWhile { it == '@' }) +inline fun mentionTextSource(whoToMention: Username) = mentionTextSource(whoToMention.full.dropWhile { it == '@' }) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PhoneNumberTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PhoneNumberTextSource.kt index b696153356..9723e82bae 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PhoneNumberTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PhoneNumberTextSource.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see phone + * @see phoneTextSource */ @Serializable data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -18,7 +18,7 @@ data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstr override val html: String by lazy { phoneHTML() } } -inline fun phone(parts: TextSourcesList) = PhoneNumberTextSource(parts.makeString(), parts) -inline fun phone(vararg parts: TextSource) = phone(parts.toList()) -inline fun phone(number: String) = phone(regular(number)) +inline fun phoneTextSource(parts: TextSourcesList) = PhoneNumberTextSource(parts.makeString(), parts) +inline fun phoneTextSource(vararg parts: TextSource) = phoneTextSource(parts.toList()) +inline fun phoneTextSource(number: String) = phoneTextSource(regularTextSource(number)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PreTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PreTextSource.kt index 63f857c692..1d3575a4ee 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PreTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PreTextSource.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see pre + * @see preTextSource */ @Serializable data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -17,5 +17,5 @@ data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) c override val html: String by lazy { source.preHTML(language) } } -inline fun pre(code: String, language: String? = null) = PreTextSource(code, language) +inline fun preTextSource(code: String, language: String? = null) = PreTextSource(code, language) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/RegularTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/RegularTextSource.kt index 5716c955b9..16080e2df1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/RegularTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/RegularTextSource.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see regular + * @see regularTextSource */ @Serializable data class RegularTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -16,6 +16,6 @@ data class RegularTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { source.regularHtml() } } -inline fun regular(text: String) = RegularTextSource(text) +inline fun regularTextSource(text: String) = RegularTextSource(text) -inline fun regularln(text: String) = regular("$text\n") +inline fun regularTextSourceLn(text: String) = regularTextSource("$text\n") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/SpoilerTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/SpoilerTextSource.kt index e822b5d788..2c849024a1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/SpoilerTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/SpoilerTextSource.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see italic + * @see italicTextSource */ @Serializable data class SpoilerTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -18,7 +18,7 @@ data class SpoilerTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { spoilerHTML() } } -inline fun spoiler(parts: TextSourcesList) = SpoilerTextSource(parts.makeString(), parts) -inline fun spoiler(vararg parts: TextSource) = spoiler(parts.toList()) -inline fun spoiler(text: String) = spoiler(regular(text)) +inline fun spoilerTextSource(parts: TextSourcesList) = SpoilerTextSource(parts.makeString(), parts) +inline fun spoilerTextSource(vararg parts: TextSource) = spoilerTextSource(parts.toList()) +inline fun spoilerTextSource(text: String) = spoilerTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/StrikethroughTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/StrikethroughTextSource.kt index abafbec241..34135e1340 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/StrikethroughTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/StrikethroughTextSource.kt @@ -20,4 +20,4 @@ data class StrikethroughTextSource @RiskFeature(DirectInvocationOfTextSourceCons inline fun strikethrough(parts: TextSourcesList) = StrikethroughTextSource(parts.makeString(), parts) inline fun strikethrough(vararg parts: TextSource) = strikethrough(parts.toList()) -inline fun strikethrough(text: String) = strikethrough(regular(text)) +inline fun strikethrough(text: String) = strikethrough(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextLinkTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextLinkTextSource.kt index 6dec0226af..6092dbdd02 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextLinkTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextLinkTextSource.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see link + * @see linkTextSource */ @Serializable data class TextLinkTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -17,4 +17,4 @@ data class TextLinkTextSource @RiskFeature(DirectInvocationOfTextSourceConstruct override val html: String by lazy { source.linkHTML(url) } } -inline fun link(text: String, url: String) = TextLinkTextSource(text, url) +inline fun linkTextSource(text: String, url: String) = TextLinkTextSource(text, url) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextMentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextMentionTextSource.kt index b8d6721a51..314c5181b7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextMentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextMentionTextSource.kt @@ -9,7 +9,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see mention + * @see mentionTextSource */ @Serializable data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -22,21 +22,21 @@ data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstr override val html: String by lazy { textMentionHTML(user.id) } } -inline fun mention(parts: TextSourcesList, user: User) = TextMentionTextSource(parts.makeString(), user, parts) -inline fun User.mention(parts: TextSourcesList) = mention(parts, this) -inline fun mention(parts: TextSourcesList, userId: UserId) = mention(parts, CommonUser(userId, "")) -inline fun UserId.mention(parts: TextSourcesList) = mention(parts, this) -inline fun mention(parts: TextSourcesList, id: RawChatId) = mention(parts, UserId(id)) -inline fun RawChatId.mention(parts: TextSourcesList) = mention(parts, this) -inline fun mention(user: User, vararg parts: TextSource) = mention( +inline fun mentionTextSource(parts: TextSourcesList, user: User) = TextMentionTextSource(parts.makeString(), user, parts) +inline fun User.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) +inline fun mentionTextSource(parts: TextSourcesList, userId: UserId) = mentionTextSource(parts, CommonUser(userId, "")) +inline fun UserId.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) +inline fun mentionTextSource(parts: TextSourcesList, id: RawChatId) = mentionTextSource(parts, UserId(id)) +inline fun RawChatId.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) +inline fun mentionTextSource(user: User, vararg parts: TextSource) = mentionTextSource( textSourcesOrElseTextSource(parts.toList()) { RegularTextSource("${user.lastName} ${user.firstName}") }, user ) -inline fun mention(text: String, user: User) = mention(user, regular(text)) -inline fun User.mention(text: String) = mention(this, regular(text)) -inline fun mention(text: String, userId: UserId) = mention(text, CommonUser(userId, "")) -inline fun UserId.mention(text: String) = mention(text, this) -inline fun mention(text: String, id: RawChatId) = mention(text, UserId(id)) -inline fun RawChatId.mention(text: String) = mention(text, this) +inline fun mentionTextSource(text: String, user: User) = mentionTextSource(user, regularTextSource(text)) +inline fun User.mentionTextSource(text: String) = mentionTextSource(this, regularTextSource(text)) +inline fun mentionTextSource(text: String, userId: UserId) = mentionTextSource(text, CommonUser(userId, "")) +inline fun UserId.mentionTextSource(text: String) = mentionTextSource(text, this) +inline fun mentionTextSource(text: String, id: RawChatId) = mentionTextSource(text, UserId(id)) +inline fun RawChatId.mentionTextSource(text: String) = mentionTextSource(text, this) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt index bd65be18b4..12dcbbd071 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt @@ -26,7 +26,7 @@ operator fun TextSource.plus(other: TextSource) = when { this is RegularTextSource && other is RegularTextSource -> listOf(RegularTextSource(source + other.source)) else -> listOf(this, other) } -operator fun TextSource.plus(text: String) = this + regular(text) +operator fun TextSource.plus(text: String) = this + regularTextSource(text) operator fun List.plus(text: String): List { val newList = mutableListOf() @@ -36,7 +36,7 @@ operator fun List.plus(text: String): List { val sublist = lastOrNull() ?.let { it + text - } ?: listOf(regular(text)) + } ?: listOf(regularTextSource(text)) newList.addAll(sublist) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/URLTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/URLTextSource.kt index f55e4ee044..87452a945a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/URLTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/URLTextSource.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see link + * @see linkTextSource */ @Serializable data class URLTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -16,4 +16,4 @@ data class URLTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) c override val html: String by lazy { source.linkHTML(source) } } -inline fun link(url: String) = URLTextSource(url) +inline fun linkTextSource(url: String) = URLTextSource(url) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource.kt index 996b7c48e7..6a40e2decd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.utils.internal.* import kotlinx.serialization.Serializable /** - * @see underline + * @see underlineTextSource */ @Serializable data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( @@ -18,6 +18,6 @@ data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstruc override val html: String by lazy { underlineHTML() } } -inline fun underline(parts: TextSourcesList) = UnderlineTextSource(parts.makeString(), parts) -inline fun underline(vararg parts: TextSource) = underline(parts.toList()) -inline fun underline(text: String) = underline(regular(text)) +inline fun underlineTextSource(parts: TextSourcesList) = UnderlineTextSource(parts.makeString(), parts) +inline fun underlineTextSource(vararg parts: TextSource) = underlineTextSource(parts.toList()) +inline fun underlineTextSource(text: String) = underlineTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt index 08a1fcfe02..3021f82c4f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt @@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.message.textsources.* typealias EntitiesBuilderBody = EntitiesBuilder.() -> Unit -val newLine = regular("\n") +val newLine = regularTextSource("\n") inline fun buildEntities(separator: TextSource? = null, init: EntitiesBuilderBody): TextSourcesList = EntitiesBuilder(separator).apply(init).build() -inline fun buildEntities(separator: String, init: EntitiesBuilderBody) = buildEntities(regular(separator), init) +inline fun buildEntities(separator: String, init: EntitiesBuilderBody) = buildEntities(regularTextSource(separator), init) /** * This builder can be used to provide building of [TextSource]s [List] @@ -51,7 +51,7 @@ class EntitiesBuilder( operator fun invoke(vararg source: TextSource) = addAll(source.toList()) operator fun String.unaryPlus(): EntitiesBuilder { - add(dev.inmo.tgbotapi.types.message.textsources.regular(this)) + add(dev.inmo.tgbotapi.types.message.textsources.regularTextSource(this)) return this@EntitiesBuilder } @@ -68,18 +68,18 @@ class EntitiesBuilder( } /** - * Add bold using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.bold] + * Add bold using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.boldTextSource] */ -inline fun EntitiesBuilder.bold(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.bold(parts)) +inline fun EntitiesBuilder.bold(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.boldTextSource(parts)) /** * Version of [EntitiesBuilder.bold] with new line at the end */ inline fun EntitiesBuilder.boldln(parts: TextSourcesList) = bold(parts) + newLine /** - * Add bold using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.bold]. + * Add bold using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.boldTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.bold(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.bold( +inline fun EntitiesBuilder.bold(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.boldTextSource( buildEntities(separator, init) )) /** @@ -88,35 +88,35 @@ inline fun EntitiesBuilder.bold(noinline init: EntitiesBuilderBody) = add(dev.in */ inline fun EntitiesBuilder.boldln(noinline init: EntitiesBuilderBody) = bold(init) + newLine /** - * Add bold using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.bold] + * Add bold using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.boldTextSource] */ -inline fun EntitiesBuilder.bold(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.bold(*parts)) +inline fun EntitiesBuilder.bold(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.boldTextSource(*parts)) /** * Version of [EntitiesBuilder.bold] with new line at the end */ inline fun EntitiesBuilder.boldln(vararg parts: TextSource) = bold(*parts) + newLine /** - * Add bold using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.bold] + * Add bold using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.boldTextSource] */ -inline fun EntitiesBuilder.bold(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.bold(text)) +inline fun EntitiesBuilder.bold(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.boldTextSource(text)) /** * Version of [EntitiesBuilder.bold] with new line at the end */ inline fun EntitiesBuilder.boldln(text: String) = bold(text) + newLine /** - * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquote] + * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource] */ -inline fun EntitiesBuilder.blockquote(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.blockquote(parts)) +inline fun EntitiesBuilder.blockquote(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource(parts)) /** * Version of [EntitiesBuilder.blockquote] with new line at the end */ inline fun EntitiesBuilder.blockquoteln(parts: TextSourcesList) = blockquote(parts) + newLine /** - * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquote]. + * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.blockquote(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.blockquote( +inline fun EntitiesBuilder.blockquote(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource( buildEntities(separator, init) )) /** @@ -125,17 +125,17 @@ inline fun EntitiesBuilder.blockquote(noinline init: EntitiesBuilderBody) = add( */ inline fun EntitiesBuilder.blockquoteln(noinline init: EntitiesBuilderBody) = blockquote(init) + newLine /** - * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquote] + * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource] */ -inline fun EntitiesBuilder.blockquote(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.blockquote(*parts)) +inline fun EntitiesBuilder.blockquote(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource(*parts)) /** * Version of [EntitiesBuilder.blockquote] with new line at the end */ inline fun EntitiesBuilder.blockquoteln(vararg parts: TextSource) = blockquote(*parts) + newLine /** - * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquote] + * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource] */ -inline fun EntitiesBuilder.blockquote(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.blockquote(text)) +inline fun EntitiesBuilder.blockquote(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource(text)) /** * Version of [EntitiesBuilder.blockquote] with new line at the end */ @@ -143,18 +143,18 @@ inline fun EntitiesBuilder.blockquoteln(text: String) = blockquote(text) + newLi /** - * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquote] + * Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquoteTextSource] */ -inline fun EntitiesBuilder.expandableBlockquote(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote(parts)) +inline fun EntitiesBuilder.expandableBlockquote(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquoteTextSource(parts)) /** * Version of [EntitiesBuilder.expandableBlockquote] with new line at the end */ inline fun EntitiesBuilder.expandableBlockquoteln(parts: TextSourcesList) = expandableBlockquote(parts) + newLine /** - * Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote]. + * Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquoteTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.expandableBlockquote(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote( +inline fun EntitiesBuilder.expandableBlockquote(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquoteTextSource( buildEntities(separator, init) )) /** @@ -163,35 +163,35 @@ inline fun EntitiesBuilder.expandableBlockquote(noinline init: EntitiesBuilderBo */ inline fun EntitiesBuilder.expandableBlockquoteln(noinline init: EntitiesBuilderBody) = expandableBlockquote(init) + newLine /** - * Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote] + * Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquoteTextSource] */ -inline fun EntitiesBuilder.expandableBlockquote(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote(*parts)) +inline fun EntitiesBuilder.expandableBlockquote(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquoteTextSource(*parts)) /** * Version of [EntitiesBuilder.expandableBlockquote] with new line at the end */ inline fun EntitiesBuilder.expandableBlockquoteln(vararg parts: TextSource) = expandableBlockquote(*parts) + newLine /** - * Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote] + * Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquoteTextSource] */ -inline fun EntitiesBuilder.expandableBlockquote(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote(text)) +inline fun EntitiesBuilder.expandableBlockquote(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquoteTextSource(text)) /** * Version of [EntitiesBuilder.expandableBlockquote] with new line at the end */ inline fun EntitiesBuilder.expandableBlockquoteln(text: String) = expandableBlockquote(text) + newLine /** - * Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoiler] + * Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoilerTextSource] */ -inline fun EntitiesBuilder.spoiler(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.spoiler(parts)) +inline fun EntitiesBuilder.spoiler(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.spoilerTextSource(parts)) /** * Version of [EntitiesBuilder.spoiler] with new line at the end */ inline fun EntitiesBuilder.spoilerln(parts: TextSourcesList) = spoiler(parts) + newLine /** - * Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoiler]. + * Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoilerTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.spoiler(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.spoiler( +inline fun EntitiesBuilder.spoiler(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.spoilerTextSource( buildEntities(separator, init) )) /** @@ -200,17 +200,17 @@ inline fun EntitiesBuilder.spoiler(noinline init: EntitiesBuilderBody) = add(dev */ inline fun EntitiesBuilder.spoilerln(noinline init: EntitiesBuilderBody) = spoiler(init) + newLine /** - * Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoiler] + * Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoilerTextSource] */ -inline fun EntitiesBuilder.spoiler(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.spoiler(*parts)) +inline fun EntitiesBuilder.spoiler(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.spoilerTextSource(*parts)) /** * Version of [EntitiesBuilder.spoiler] with new line at the end */ inline fun EntitiesBuilder.spoilerln(vararg parts: TextSource) = spoiler(*parts) + newLine /** - * Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoiler] + * Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoilerTextSource] */ -inline fun EntitiesBuilder.spoiler(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.spoiler(text)) +inline fun EntitiesBuilder.spoiler(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.spoilerTextSource(text)) /** * Version of [EntitiesBuilder.spoiler] with new line at the end */ @@ -218,17 +218,17 @@ inline fun EntitiesBuilder.spoilerln(text: String) = spoiler(text) + newLine /** - * Add botCommand using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.botCommand] + * Add botCommand using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.botCommandTextSource] */ -inline fun EntitiesBuilder.botCommand(command: String) = add(dev.inmo.tgbotapi.types.message.textsources.botCommand(command)) +inline fun EntitiesBuilder.botCommand(command: String) = add(dev.inmo.tgbotapi.types.message.textsources.botCommandTextSource(command)) /** * Version of [EntitiesBuilder.botCommand] with new line at the end */ inline fun EntitiesBuilder.botCommandln(command: String) = botCommand(command) + newLine /** - * Add botCommand using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.botCommand] + * Add botCommand using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.botCommandTextSource] */ -inline fun EntitiesBuilder.botCommand(botCommand: BotCommand) = add(dev.inmo.tgbotapi.types.message.textsources.botCommand(botCommand)) +inline fun EntitiesBuilder.botCommand(botCommand: BotCommand) = add(dev.inmo.tgbotapi.types.message.textsources.botCommandTextSource(botCommand)) /** * Version of [EntitiesBuilder.botCommand] with new line at the end */ @@ -237,18 +237,18 @@ inline fun EntitiesBuilder.botCommandln(botCommand: BotCommand) = botCommand(bot /** - * Add cashTag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.cashTag] + * Add cashTag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.cashTagTextSource] */ -inline fun EntitiesBuilder.cashTag(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.cashTag(parts)) +inline fun EntitiesBuilder.cashTag(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.cashTagTextSource(parts)) /** * Version of [EntitiesBuilder.cashTag] with new line at the end */ inline fun EntitiesBuilder.cashTagln(parts: TextSourcesList) = cashTag(parts) + newLine /** - * Add cashTag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.cashTag]. + * Add cashTag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.cashTagTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.cashTag(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.cashTag( +inline fun EntitiesBuilder.cashTag(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.cashTagTextSource( buildEntities(separator, init) )) /** @@ -257,17 +257,17 @@ inline fun EntitiesBuilder.cashTag(noinline init: EntitiesBuilderBody) = add(dev */ inline fun EntitiesBuilder.cashTagln(noinline init: EntitiesBuilderBody) = cashTag(init) + newLine /** - * Add cashTag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.cashTag] + * Add cashTag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.cashTagTextSource] */ -inline fun EntitiesBuilder.cashTag(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.cashTag(*parts)) +inline fun EntitiesBuilder.cashTag(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.cashTagTextSource(*parts)) /** * Version of [EntitiesBuilder.cashTag] with new line at the end */ inline fun EntitiesBuilder.cashTagln(vararg parts: TextSource) = cashTag(*parts) + newLine /** - * Add cashTag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.cashTag] + * Add cashTag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.cashTagTextSource] */ -inline fun EntitiesBuilder.cashTag(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.cashTag(text)) +inline fun EntitiesBuilder.cashTag(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.cashTagTextSource(text)) /** * Version of [EntitiesBuilder.cashTag] with new line at the end */ @@ -275,9 +275,9 @@ inline fun EntitiesBuilder.cashTagln(text: String) = cashTag(text) + newLine /** - * Add code using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.code] + * Add code using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.codeTextSource] */ -inline fun EntitiesBuilder.code(code: String) = add(dev.inmo.tgbotapi.types.message.textsources.code(code)) +inline fun EntitiesBuilder.code(code: String) = add(dev.inmo.tgbotapi.types.message.textsources.codeTextSource(code)) /** * Version of [EntitiesBuilder.code] with new line at the end */ @@ -285,18 +285,18 @@ inline fun EntitiesBuilder.codeln(code: String) = code(code) + newLine /** - * Add email using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.email] + * Add email using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.emailTextSource] */ -inline fun EntitiesBuilder.email(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.email(parts)) +inline fun EntitiesBuilder.email(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.emailTextSource(parts)) /** * Version of [EntitiesBuilder.email] with new line at the end */ inline fun EntitiesBuilder.emailln(parts: TextSourcesList) = email(parts) + newLine /** - * Add email using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.email]. + * Add email using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.emailTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.email(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.email( +inline fun EntitiesBuilder.email(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.emailTextSource( buildEntities(separator, init) )) /** @@ -305,17 +305,17 @@ inline fun EntitiesBuilder.email(noinline init: EntitiesBuilderBody) = add(dev.i */ inline fun EntitiesBuilder.emailln(noinline init: EntitiesBuilderBody) = email(init) + newLine /** - * Add email using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.email] + * Add email using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.emailTextSource] */ -inline fun EntitiesBuilder.email(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.email(*parts)) +inline fun EntitiesBuilder.email(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.emailTextSource(*parts)) /** * Version of [EntitiesBuilder.email] with new line at the end */ inline fun EntitiesBuilder.emailln(vararg parts: TextSource) = email(*parts) + newLine /** - * Add email using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.email] + * Add email using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.emailTextSource] */ -inline fun EntitiesBuilder.email(emailAddress: String) = add(dev.inmo.tgbotapi.types.message.textsources.email(emailAddress)) +inline fun EntitiesBuilder.email(emailAddress: String) = add(dev.inmo.tgbotapi.types.message.textsources.emailTextSource(emailAddress)) /** * Version of [EntitiesBuilder.email] with new line at the end */ @@ -323,18 +323,18 @@ inline fun EntitiesBuilder.emailln(emailAddress: String) = email(emailAddress) + /** - * Add hashtag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.hashtag] + * Add hashtag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.hashtagTextSource] */ -inline fun EntitiesBuilder.hashtag(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.hashtag(parts)) +inline fun EntitiesBuilder.hashtag(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.hashtagTextSource(parts)) /** * Version of [EntitiesBuilder.hashtag] with new line at the end */ inline fun EntitiesBuilder.hashtagln(parts: TextSourcesList) = hashtag(parts) + newLine /** - * Add hashtag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.hashtag]. + * Add hashtag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.hashtagTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.hashtag(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.hashtag( +inline fun EntitiesBuilder.hashtag(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.hashtagTextSource( buildEntities(separator, init) )) /** @@ -343,17 +343,17 @@ inline fun EntitiesBuilder.hashtag(noinline init: EntitiesBuilderBody) = add(dev */ inline fun EntitiesBuilder.hashtagln(noinline init: EntitiesBuilderBody) = hashtag(init) + newLine /** - * Add hashtag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.hashtag] + * Add hashtag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.hashtagTextSource] */ -inline fun EntitiesBuilder.hashtag(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.hashtag(*parts)) +inline fun EntitiesBuilder.hashtag(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.hashtagTextSource(*parts)) /** * Version of [EntitiesBuilder.hashtag] with new line at the end */ inline fun EntitiesBuilder.hashtagln(vararg parts: TextSource) = hashtag(*parts) + newLine /** - * Add hashtag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.hashtag] + * Add hashtag using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.hashtagTextSource] */ -inline fun EntitiesBuilder.hashtag(hashtag: String) = add(dev.inmo.tgbotapi.types.message.textsources.hashtag(hashtag)) +inline fun EntitiesBuilder.hashtag(hashtag: String) = add(dev.inmo.tgbotapi.types.message.textsources.hashtagTextSource(hashtag)) /** * Version of [EntitiesBuilder.hashtag] with new line at the end */ @@ -361,18 +361,18 @@ inline fun EntitiesBuilder.hashtagln(hashtag: String) = hashtag(hashtag) + newLi /** - * Add italic using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.italic] + * Add italic using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.italicTextSource] */ -inline fun EntitiesBuilder.italic(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.italic(parts)) +inline fun EntitiesBuilder.italic(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.italicTextSource(parts)) /** * Version of [EntitiesBuilder.italic] with new line at the end */ inline fun EntitiesBuilder.italicln(parts: TextSourcesList) = italic(parts) + newLine /** - * Add italic using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.italic]. + * Add italic using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.italicTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.italic(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.italic( +inline fun EntitiesBuilder.italic(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.italicTextSource( buildEntities(separator, init) )) /** @@ -381,17 +381,17 @@ inline fun EntitiesBuilder.italic(noinline init: EntitiesBuilderBody) = add(dev. */ inline fun EntitiesBuilder.italicln(noinline init: EntitiesBuilderBody) = italic(init) + newLine /** - * Add italic using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.italic] + * Add italic using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.italicTextSource] */ -inline fun EntitiesBuilder.italic(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.italic(*parts)) +inline fun EntitiesBuilder.italic(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.italicTextSource(*parts)) /** * Version of [EntitiesBuilder.italic] with new line at the end */ inline fun EntitiesBuilder.italicln(vararg parts: TextSource) = italic(*parts) + newLine /** - * Add italic using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.italic] + * Add italic using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.italicTextSource] */ -inline fun EntitiesBuilder.italic(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.italic(text)) +inline fun EntitiesBuilder.italic(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.italicTextSource(text)) /** * Version of [EntitiesBuilder.italic] with new line at the end */ @@ -399,18 +399,18 @@ inline fun EntitiesBuilder.italicln(text: String) = italic(text) + newLine /** - * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mention] + * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mentionTextSource] */ -inline fun EntitiesBuilder.mention(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.mention(parts)) +inline fun EntitiesBuilder.mention(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource(parts)) /** * Version of [EntitiesBuilder.mention] with new line at the end */ inline fun EntitiesBuilder.mentionln(parts: TextSourcesList) = mention(parts) + newLine /** - * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mention]. + * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mentionTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.mention(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.mention( +inline fun EntitiesBuilder.mention(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource( buildEntities(separator, init) )) /** @@ -419,25 +419,25 @@ inline fun EntitiesBuilder.mention(noinline init: EntitiesBuilderBody) = add(dev */ inline fun EntitiesBuilder.mentionln(noinline init: EntitiesBuilderBody) = mention(init) + newLine /** - * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mention] + * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mentionTextSource] */ -inline fun EntitiesBuilder.mention(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.mention(*parts)) +inline fun EntitiesBuilder.mention(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource(*parts)) /** * Version of [EntitiesBuilder.mention] with new line at the end */ inline fun EntitiesBuilder.mentionln(vararg parts: TextSource) = mention(*parts) + newLine /** - * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mention] + * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mentionTextSource] */ -inline fun EntitiesBuilder.mention(whoToMention: String) = add(dev.inmo.tgbotapi.types.message.textsources.mention(whoToMention)) +inline fun EntitiesBuilder.mention(whoToMention: String) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource(whoToMention)) /** * Version of [EntitiesBuilder.mention] with new line at the end */ inline fun EntitiesBuilder.mentionln(whoToMention: String) = mention(whoToMention) + newLine /** - * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mention] + * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mentionTextSource] */ -inline fun EntitiesBuilder.mention(parts: TextSourcesList, user: User) = add(dev.inmo.tgbotapi.types.message.textsources.mention(parts, user)) +inline fun EntitiesBuilder.mention(parts: TextSourcesList, user: User) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource(parts, user)) /** * Version of [EntitiesBuilder.mention] with new line at the end */ @@ -445,24 +445,24 @@ inline fun EntitiesBuilder.mentionln(parts: TextSourcesList, user: User) = menti inline fun EntitiesBuilder.mention( user: User, vararg parts: TextSource -) = add(dev.inmo.tgbotapi.types.message.textsources.mention(user, *parts)) +) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource(user, *parts)) /** * Version of [EntitiesBuilder.mention] with new line at the end */ inline fun EntitiesBuilder.mentionln(user: User, vararg parts: TextSource) = mention(user, *parts) + newLine /** - * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mention] + * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mentionTextSource] */ -inline fun EntitiesBuilder.mention(text: String, user: User) = add(dev.inmo.tgbotapi.types.message.textsources.mention(text, user)) +inline fun EntitiesBuilder.mention(text: String, user: User) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource(text, user)) /** * Version of [EntitiesBuilder.mention] with new line at the end */ inline fun EntitiesBuilder.mentionln(text: String, user: User) = mention(text, user) + newLine /** - * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mention] + * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mentionTextSource] */ -inline fun EntitiesBuilder.mention(parts: TextSourcesList, userId: UserId) = add(dev.inmo.tgbotapi.types.message.textsources.mention(parts, userId)) +inline fun EntitiesBuilder.mention(parts: TextSourcesList, userId: UserId) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource(parts, userId)) /** * Version of [EntitiesBuilder.mention] with new line at the end */ @@ -476,9 +476,9 @@ inline fun EntitiesBuilder.mention( */ inline fun EntitiesBuilder.mentionln(userId: UserId, vararg parts: TextSource) = mention(userId, *parts) + newLine /** - * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mention] + * Add mention using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.mentionTextSource] */ -inline fun EntitiesBuilder.mention(text: String, userId: UserId) = add(dev.inmo.tgbotapi.types.message.textsources.mention(text, userId)) +inline fun EntitiesBuilder.mention(text: String, userId: UserId) = add(dev.inmo.tgbotapi.types.message.textsources.mentionTextSource(text, userId)) /** * Version of [EntitiesBuilder.mention] with new line at the end */ @@ -486,18 +486,18 @@ inline fun EntitiesBuilder.mentionln(text: String, userId: UserId) = mention(tex /** - * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phone] + * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phoneTextSource] */ -inline fun EntitiesBuilder.phone(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.phone(parts)) +inline fun EntitiesBuilder.phone(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.phoneTextSource(parts)) /** * Version of [EntitiesBuilder.phone] with new line at the end */ inline fun EntitiesBuilder.phoneln(parts: TextSourcesList) = phone(parts) + newLine /** - * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phone]. + * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phoneTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.phone(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.phone( +inline fun EntitiesBuilder.phone(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.phoneTextSource( buildEntities(separator, init) )) /** @@ -506,17 +506,17 @@ inline fun EntitiesBuilder.phone(noinline init: EntitiesBuilderBody) = add(dev.i */ inline fun EntitiesBuilder.phoneln(noinline init: EntitiesBuilderBody) = phone(init) + newLine /** - * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phone] + * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phoneTextSource] */ -inline fun EntitiesBuilder.phone(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.phone(*parts)) +inline fun EntitiesBuilder.phone(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.phoneTextSource(*parts)) /** * Version of [EntitiesBuilder.phone] with new line at the end */ inline fun EntitiesBuilder.phoneln(vararg parts: TextSource) = phone(*parts) + newLine /** - * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phone] + * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phoneTextSource] */ -inline fun EntitiesBuilder.phone(number: String) = add(dev.inmo.tgbotapi.types.message.textsources.phone(number)) +inline fun EntitiesBuilder.phone(number: String) = add(dev.inmo.tgbotapi.types.message.textsources.phoneTextSource(number)) /** * Version of [EntitiesBuilder.phone] with new line at the end */ @@ -524,24 +524,24 @@ inline fun EntitiesBuilder.phoneln(number: String) = phone(number) + newLine /** - * Add pre using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.pre] + * Add pre using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.preTextSource] */ -inline fun EntitiesBuilder.pre(code: String, language: String?) = add(dev.inmo.tgbotapi.types.message.textsources.pre(code, language)) +inline fun EntitiesBuilder.pre(code: String, language: String?) = add(dev.inmo.tgbotapi.types.message.textsources.preTextSource(code, language)) /** * Version of [EntitiesBuilder.pre] with new line at the end */ inline fun EntitiesBuilder.preln(code: String, language: String?) = pre(code, language) + newLine /** - * Will add simple [dev.inmo.tgbotapi.types.message.textsources.regular] [TextSource] + * Will add simple [dev.inmo.tgbotapi.types.message.textsources.regularTextSource] [TextSource] * * @see RegularTextSource * @see dev.inmo.tgbotapi.extensions.utils.formatting.regularln */ inline fun EntitiesBuilder.regular(text: String) = - add(dev.inmo.tgbotapi.types.message.textsources.regular(text)) + add(dev.inmo.tgbotapi.types.message.textsources.regularTextSource(text)) /** - * Will add simple [dev.inmo.tgbotapi.types.message.textsources.regular] [TextSource] and "\n" at the end + * Will add simple [dev.inmo.tgbotapi.types.message.textsources.regularTextSource] [TextSource] and "\n" at the end * * @see RegularTextSource * @see dev.inmo.tgbotapi.extensions.utils.formatting.regular @@ -588,17 +588,17 @@ inline fun EntitiesBuilder.strikethroughln(text: String) = strikethrough(text) + /** - * Add link using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.link] + * Add link using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.linkTextSource] */ -inline fun EntitiesBuilder.link(text: String, url: String) = add(dev.inmo.tgbotapi.types.message.textsources.link(text, url)) +inline fun EntitiesBuilder.link(text: String, url: String) = add(dev.inmo.tgbotapi.types.message.textsources.linkTextSource(text, url)) /** * Version of [EntitiesBuilder.link] with new line at the end */ inline fun EntitiesBuilder.linkln(text: String, url: String) = link(text, url) + newLine /** - * Add link using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.link] + * Add link using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.linkTextSource] */ -inline fun EntitiesBuilder.link(url: String) = add(dev.inmo.tgbotapi.types.message.textsources.link(url)) +inline fun EntitiesBuilder.link(url: String) = add(dev.inmo.tgbotapi.types.message.textsources.linkTextSource(url)) /** * Version of [EntitiesBuilder.link] with new line at the end */ @@ -606,18 +606,18 @@ inline fun EntitiesBuilder.linkln(url: String) = link(url) + newLine /** - * Add underline using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.underline] + * Add underline using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.underlineTextSource] */ -inline fun EntitiesBuilder.underline(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.underline(parts)) +inline fun EntitiesBuilder.underline(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.underlineTextSource(parts)) /** * Version of [EntitiesBuilder.underline] with new line at the end */ inline fun EntitiesBuilder.underlineln(parts: TextSourcesList) = underline(parts) + newLine /** - * Add underline using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.underline]. + * Add underline using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.underlineTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.underline(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.underline( +inline fun EntitiesBuilder.underline(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.underlineTextSource( buildEntities(separator, init) )) /** @@ -626,17 +626,17 @@ inline fun EntitiesBuilder.underline(noinline init: EntitiesBuilderBody) = add(d */ inline fun EntitiesBuilder.underlineln(noinline init: EntitiesBuilderBody) = underline(init) + newLine /** - * Add underline using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.underline] + * Add underline using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.underlineTextSource] */ -inline fun EntitiesBuilder.underline(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.underline(*parts)) +inline fun EntitiesBuilder.underline(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.underlineTextSource(*parts)) /** * Version of [EntitiesBuilder.underline] with new line at the end */ inline fun EntitiesBuilder.underlineln(vararg parts: TextSource) = underline(*parts) + newLine /** - * Add underline using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.underline] + * Add underline using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.underlineTextSource] */ -inline fun EntitiesBuilder.underline(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.underline(text)) +inline fun EntitiesBuilder.underline(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.underlineTextSource(text)) /** * Version of [EntitiesBuilder.underline] with new line at the end */ @@ -644,35 +644,35 @@ inline fun EntitiesBuilder.underlineln(text: String) = underline(text) + newLine /** - * Add customEmoji using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.customEmoji] + * Add customEmoji using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.customEmojiTextSource] */ -inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.customEmoji(customEmojiId, parts)) +inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.customEmojiTextSource(customEmojiId, parts)) /** * Version of [EntitiesBuilder.customEmoji] with new line at the end */ inline fun EntitiesBuilder.customEmojiln(customEmojiId: CustomEmojiId, parts: TextSourcesList) = customEmoji(customEmojiId, parts) + newLine /** - * Add customEmoji using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.customEmoji]. + * Add customEmoji using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.customEmojiTextSource]. * Will reuse separator config from [buildEntities] */ -inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.customEmoji(customEmojiId, buildEntities(separator, init))) +inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.customEmojiTextSource(customEmojiId, buildEntities(separator, init))) /** * Version of [EntitiesBuilder.customEmoji] with new line at the end. * Will reuse separator config from [buildEntities] */ inline fun EntitiesBuilder.customEmojiln(customEmojiId: CustomEmojiId, noinline init: EntitiesBuilderBody) = customEmoji(customEmojiId, init) + newLine /** - * Add customEmoji using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.customEmoji] + * Add customEmoji using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.customEmojiTextSource] */ -inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.customEmoji(customEmojiId, *parts)) +inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.customEmojiTextSource(customEmojiId, *parts)) /** * Version of [EntitiesBuilder.customEmoji] with new line at the end */ inline fun EntitiesBuilder.customEmojiln(customEmojiId: CustomEmojiId, vararg parts: TextSource) = customEmoji(customEmojiId, *parts) + newLine /** - * Add customEmoji using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.customEmoji] + * Add customEmoji using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.customEmojiTextSource] */ -inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, text: String) = add(dev.inmo.tgbotapi.types.message.textsources.customEmoji(customEmojiId, text)) +inline fun EntitiesBuilder.customEmoji(customEmojiId: CustomEmojiId, text: String) = add(dev.inmo.tgbotapi.types.message.textsources.customEmojiTextSource(customEmojiId, text)) /** * Version of [EntitiesBuilder.customEmoji] with new line at the end */ diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/StringFormattingTests.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/StringFormattingTests.kt index 063e20a185..b6e4bc4214 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/StringFormattingTests.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/StringFormattingTests.kt @@ -39,24 +39,24 @@ class StringFormattingTests { @Test fun testThatCreatingOfStringWithSimpleDSLWorksCorrectly() { - val sources: TextSourcesList = regular("It (is?) ") + - bold(italic("is") + + val sources: TextSourcesList = regularTextSource("It (is?) ") + + boldTextSource(italicTextSource("is") + " " + - strikethrough(underline("simple"))) + + strikethrough(underlineTextSource("simple"))) + " " + - spoiler("hello world") + + spoilerTextSource("hello world") + " with " + - hashtag("tag@sample") + + hashtagTextSource("tag@sample") + " and " + - mention("mention") + + mentionTextSource("mention") + ". Start of blockquote: " + - blockquote( + blockquoteTextSource( "Block quotation started\n" + "Block quotation continued\n" + "The last line of the block quotation" ) + "\n. Start of expandable blockquote: " + - expandableBlockquote( + expandableBlockquoteTextSource( "Block quotation started\n" + "Block quotation continued\n" + "The last line of the block quotation" diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt index 95a1e0cc2b..7b0977345a 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt @@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.utils.formatting import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.* import dev.inmo.tgbotapi.types.message.abstracts.Message -import dev.inmo.tgbotapi.types.message.textsources.link +import dev.inmo.tgbotapi.types.message.textsources.linkTextSource import io.ktor.http.encodeURLQueryComponent @@ -115,4 +115,4 @@ val Chat.chatLink: String? private const val stickerSetAddingLinkPrefix = "$internalLinkBeginning/addstickers" val StickerSetName.stickerSetLink - get() = link(string, "$stickerSetAddingLinkPrefix/$this") + get() = linkTextSource(string, "$stickerSetAddingLinkPrefix/$this")