diff --git a/CHANGELOG.md b/CHANGELOG.md index 015c7c1a3d..0eb3f26a57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ * `Core`: * Improvements in `Update.sourceUser` extension * Add extension `PrivateChat.toUser` + * Builder methods of `TextSource`s (like `pre` which returns `PreTextSource`) lost suppression of `redundant inline` +due to its redundancy + * Add `mention` builders for `EntitiesBuilder` with `UserId` as variant instead of `User` * `BehaviourBuilder`: * Add support of several rounds for `CombinedSubcontextInitialAction`. Now it will try hard to execute all its `SubAction` while all actions will not be completed successfully OR all left actions will not complete with errors diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 69d64aeb19..e03366dacb 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -26989,6 +26989,9 @@ public final class dev/inmo/tgbotapi/utils/EntitiesBuilderKt { public static final fun mention (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/util/List;Ldev/inmo/tgbotapi/types/chat/User;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun mention (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun mention (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;[Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; + public static final fun mention-dEpx-Zg (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;J[Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; + public static final fun mention-rcVkPyE (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/lang/String;J)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; + public static final fun mention-rcVkPyE (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/util/List;J)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun mentionln (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ldev/inmo/tgbotapi/types/chat/User;[Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun mentionln (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/lang/String;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun mentionln (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; @@ -26996,6 +26999,9 @@ public final class dev/inmo/tgbotapi/utils/EntitiesBuilderKt { public static final fun mentionln (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/util/List;Ldev/inmo/tgbotapi/types/chat/User;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun mentionln (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun mentionln (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;[Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; + public static final fun mentionln-dEpx-Zg (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;J[Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; + public static final fun mentionln-rcVkPyE (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/lang/String;J)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; + public static final fun mentionln-rcVkPyE (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/util/List;J)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun phone (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/lang/String;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun phone (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Ljava/util/List;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; public static final fun phone (Ldev/inmo/tgbotapi/utils/EntitiesBuilder;Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/utils/EntitiesBuilder; 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 dca58afbc9..251795d3f8 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 @@ -18,9 +18,6 @@ data class BlockquoteTextSource @RiskFeature(DirectInvocationOfTextSourceConstru override val html: String by lazy { blockquoteHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun blockquote(parts: TextSourcesList) = BlockquoteTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun blockquote(vararg parts: TextSource) = blockquote(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun blockquote(text: String) = blockquote(regular(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 3b5ac0410b..fa6cdf91c7 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 @@ -18,9 +18,6 @@ data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { boldHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun bold(parts: TextSourcesList) = BoldTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun bold(vararg parts: TextSource) = bold(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun bold(text: String) = bold(regular(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 43cdf2b685..a58154ac46 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 @@ -33,8 +33,6 @@ data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstru /** * @param command Without leading "/" */ -@Suppress("NOTHING_TO_INLINE") inline fun botCommand(command: String) = BotCommandTextSource("/$command") -@Suppress("NOTHING_TO_INLINE") inline fun botCommand(botCommand: BotCommand) = botCommand(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 cd1a809282..a29cc6a629 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 @@ -25,9 +25,6 @@ data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { cashTagHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun cashTag(parts: TextSourcesList) = CashTagTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun cashTag(vararg parts: TextSource) = cashTag(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun cashTag(tag: String) = cashTag(regular(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 590c4dfb16..aab08039e7 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 @@ -16,5 +16,4 @@ data class CodeTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { source.codeHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun code(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 cc958faf5a..13adb22689 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 @@ -20,12 +20,10 @@ data class CustomEmojiTextSource @RiskFeature(DirectInvocationOfTextSourceConstr override val html: String by lazy { source.customEmojiHTML(customEmojiId) } } -@Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_API_USAGE") +@Suppress("EXPERIMENTAL_API_USAGE") inline fun customEmoji(emojiId: CustomEmojiId, parts: TextSourcesList) = CustomEmojiTextSource(parts.makeString(), emojiId, parts) -@Suppress("NOTHING_TO_INLINE") inline fun customEmoji(emojiId: CustomEmojiId, vararg parts: TextSource) = customEmoji(emojiId, parts.toList()) /** * Without sharp (#) */ -@Suppress("NOTHING_TO_INLINE") inline fun customEmoji(emojiId: CustomEmojiId, text: String) = customEmoji(emojiId, regular(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 3f48b5b37e..59a94e0917 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 @@ -18,9 +18,6 @@ data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { emailHTML(source) } } -@Suppress("NOTHING_TO_INLINE") inline fun email(parts: TextSourcesList) = EMailTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun email(vararg parts: TextSource) = email(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun email(emailAddress: String) = email(regular(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 50730463e1..0cfb17b152 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 @@ -18,9 +18,6 @@ data class ExpandableBlockquoteTextSource @RiskFeature(DirectInvocationOfTextSou override val html: String by lazy { expandableBlockquoteHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun expandableBlockquote(parts: TextSourcesList) = ExpandableBlockquoteTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun expandableBlockquote(vararg parts: TextSource) = expandableBlockquote(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun expandableBlockquote(text: String) = expandableBlockquote(regular(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 1548b7cc54..ae53aea509 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 @@ -32,12 +32,10 @@ data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } } -@Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_API_USAGE") +@Suppress("EXPERIMENTAL_API_USAGE") inline fun hashtag(parts: TextSourcesList) = (regular("#") + parts).let { HashTagTextSource(it.makeString(), it) } -@Suppress("NOTHING_TO_INLINE") inline fun hashtag(vararg parts: TextSource) = hashtag(parts.toList()) /** * Without sharp (#) */ -@Suppress("NOTHING_TO_INLINE") inline fun hashtag(hashtag: String) = hashtag(regular(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 9fbc093e77..0deddc83c7 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 @@ -18,10 +18,7 @@ data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor override val html: String by lazy { italicHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun italic(parts: TextSourcesList) = ItalicTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun italic(vararg parts: TextSource) = italic(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun italic(text: String) = italic(regular(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 933293694d..17e39b6f50 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 @@ -33,17 +33,13 @@ data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } } -@Suppress("NOTHING_TO_INLINE") inline fun mention(parts: TextSourcesList) = (regular("@") + parts).let { MentionTextSource(it.makeString(), it) } -@Suppress("NOTHING_TO_INLINE") inline fun mention(vararg parts: TextSource) = mention(parts.toList()) /** * Without leading "@" */ -@Suppress("NOTHING_TO_INLINE") inline fun mention(whoToMention: String) = mention(regular(whoToMention)) -@Suppress("NOTHING_TO_INLINE") inline fun mention(whoToMention: Username) = mention(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 c2d8416b6f..b696153356 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 @@ -18,10 +18,7 @@ data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstr override val html: String by lazy { phoneHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun phone(parts: TextSourcesList) = PhoneNumberTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun phone(vararg parts: TextSource) = phone(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun phone(number: String) = phone(regular(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 a532c28a38..63f857c692 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 @@ -17,6 +17,5 @@ data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) c override val html: String by lazy { source.preHTML(language) } } -@Suppress("NOTHING_TO_INLINE") inline fun pre(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 4593f54121..5716c955b9 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 @@ -16,8 +16,6 @@ data class RegularTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { source.regularHtml() } } -@Suppress("NOTHING_TO_INLINE") inline fun regular(text: String) = RegularTextSource(text) -@Suppress("NOTHING_TO_INLINE") inline fun regularln(text: String) = regular("$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 6b4e10ae26..e822b5d788 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 @@ -18,10 +18,7 @@ data class SpoilerTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { spoilerHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun spoiler(parts: TextSourcesList) = SpoilerTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun spoiler(vararg parts: TextSource) = spoiler(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun spoiler(text: String) = spoiler(regular(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 046115e3fd..abafbec241 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 @@ -18,9 +18,6 @@ data class StrikethroughTextSource @RiskFeature(DirectInvocationOfTextSourceCons override val markdown: String by lazy { source.strikethroughMarkdown() } } -@Suppress("NOTHING_TO_INLINE") inline fun strikethrough(parts: TextSourcesList) = StrikethroughTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun strikethrough(vararg parts: TextSource) = strikethrough(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun strikethrough(text: String) = strikethrough(regular(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 1e6bb5a026..6dec0226af 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 @@ -17,5 +17,4 @@ data class TextLinkTextSource @RiskFeature(DirectInvocationOfTextSourceConstruct override val html: String by lazy { source.linkHTML(url) } } -@Suppress("NOTHING_TO_INLINE") inline fun link(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 8a47d7c11d..b8d6721a51 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 @@ -22,34 +22,21 @@ data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstr override val html: String by lazy { textMentionHTML(user.id) } } -@Suppress("NOTHING_TO_INLINE") inline fun mention(parts: TextSourcesList, user: User) = TextMentionTextSource(parts.makeString(), user, parts) -@Suppress("NOTHING_TO_INLINE") inline fun User.mention(parts: TextSourcesList) = mention(parts, this) -@Suppress("NOTHING_TO_INLINE") inline fun mention(parts: TextSourcesList, userId: UserId) = mention(parts, CommonUser(userId, "")) -@Suppress("NOTHING_TO_INLINE") inline fun UserId.mention(parts: TextSourcesList) = mention(parts, this) -@Suppress("NOTHING_TO_INLINE") inline fun mention(parts: TextSourcesList, id: RawChatId) = mention(parts, UserId(id)) -@Suppress("NOTHING_TO_INLINE") inline fun RawChatId.mention(parts: TextSourcesList) = mention(parts, this) -@Suppress("NOTHING_TO_INLINE") inline fun mention(user: User, vararg parts: TextSource) = mention( textSourcesOrElseTextSource(parts.toList()) { RegularTextSource("${user.lastName} ${user.firstName}") }, user ) -@Suppress("NOTHING_TO_INLINE") inline fun mention(text: String, user: User) = mention(user, regular(text)) -@Suppress("NOTHING_TO_INLINE") inline fun User.mention(text: String) = mention(this, regular(text)) -@Suppress("NOTHING_TO_INLINE") inline fun mention(text: String, userId: UserId) = mention(text, CommonUser(userId, "")) -@Suppress("NOTHING_TO_INLINE") inline fun UserId.mention(text: String) = mention(text, this) -@Suppress("NOTHING_TO_INLINE") inline fun mention(text: String, id: RawChatId) = mention(text, UserId(id)) -@Suppress("NOTHING_TO_INLINE") inline fun RawChatId.mention(text: String) = mention(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 e2ee14a630..bd65be18b4 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 @@ -101,7 +101,6 @@ fun List.splitForCaption(): List> { /** * This method will prepare [TextSource]s list for messages with [textLength] */ -@Suppress("NOTHING_TO_INLINE") inline fun List.splitForText(): List> = splitForMessage(textLength) fun List.separateForMessage(limit: IntRange, numberOfParts: Int? = null): List> = splitForMessage(limit, numberOfParts) @@ -115,5 +114,4 @@ fun List.separateForCaption(): List> = splitForCapt /** * This method will prepare [TextSource]s list for messages with [textLength] */ -@Suppress("NOTHING_TO_INLINE") inline fun List.separateForText(): List> = splitForText() 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 c1eb901054..f55e4ee044 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 @@ -16,5 +16,4 @@ data class URLTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) c override val html: String by lazy { source.linkHTML(source) } } -@Suppress("NOTHING_TO_INLINE") inline fun link(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 fafe56a3d0..996b7c48e7 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 @@ -18,9 +18,6 @@ data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstruc override val html: String by lazy { underlineHTML() } } -@Suppress("NOTHING_TO_INLINE") inline fun underline(parts: TextSourcesList) = UnderlineTextSource(parts.makeString(), parts) -@Suppress("NOTHING_TO_INLINE") inline fun underline(vararg parts: TextSource) = underline(parts.toList()) -@Suppress("NOTHING_TO_INLINE") inline fun underline(text: String) = underline(regular(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 7fd8804f4f..08a1fcfe02 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 @@ -5,6 +5,7 @@ package dev.inmo.tgbotapi.utils import dev.inmo.micro_utils.common.joinTo import dev.inmo.tgbotapi.types.BotCommand import dev.inmo.tgbotapi.types.CustomEmojiId +import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.message.textsources.* @@ -458,6 +459,31 @@ inline fun EntitiesBuilder.mention(text: String, user: User) = add(dev.inmo.tgbo */ 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] + */ +inline fun EntitiesBuilder.mention(parts: TextSourcesList, userId: UserId) = add(dev.inmo.tgbotapi.types.message.textsources.mention(parts, userId)) +/** + * Version of [EntitiesBuilder.mention] with new line at the end + */ +inline fun EntitiesBuilder.mentionln(parts: TextSourcesList, userId: UserId) = mention(parts, userId) + newLine +inline fun EntitiesBuilder.mention( + userId: UserId, + vararg parts: TextSource +) = mention(parts.toList(), userId) +/** + * Version of [EntitiesBuilder.mention] with new line at the end + */ +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] + */ +inline fun EntitiesBuilder.mention(text: String, userId: UserId) = add(dev.inmo.tgbotapi.types.message.textsources.mention(text, userId)) +/** + * Version of [EntitiesBuilder.mention] with new line at the end + */ +inline fun EntitiesBuilder.mentionln(text: String, userId: UserId) = mention(text, userId) + newLine + /** * Add phone using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.phone]