diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a9dec1e68..c5f2afa8cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # TelegramBotAPI changelog +## 0.38.6 + +* `Common`: + * `Version`: + * `MicroUtils`: `0.9.6` -> `0.9.9` + * `Klock`: `2.4.13` -> `2.5.2` +* `Core`: + * New member of `MentionTextSource` - `username` + ## 0.38.5 * `Common`: diff --git a/gradle.properties b/gradle.properties index 3e281dc024..00382e11b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,11 +8,11 @@ kotlin.incremental.js=true kotlin_version=1.6.10 kotlin_coroutines_version=1.6.0 kotlin_serialisation_runtime_version=1.3.2 -klock_version=2.4.13 +klock_version=2.5.2 uuid_version=0.4.0 ktor_version=1.6.7 -micro_utils_version=0.9.6 +micro_utils_version=0.9.9 javax_activation_version=1.1.1 @@ -20,6 +20,6 @@ javax_activation_version=1.1.1 dokka_version=1.6.10 library_group=dev.inmo -library_version=0.38.5 +library_version=0.38.6 github_release_plugin_version=2.2.12 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt index 471c316a28..b0a5d8db3f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt @@ -1,5 +1,6 @@ package dev.inmo.tgbotapi.types.MessageEntity.textsources +import dev.inmo.tgbotapi.types.Username import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.extensions.makeString import dev.inmo.tgbotapi.utils.internal.* @@ -23,6 +24,7 @@ data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val markdown: String by lazy { source.mentionMarkdown() } override val markdownV2: String by lazy { mentionMarkdownV2() } override val html: String by lazy { mentionHTML() } + val username: Username = Username(source) init { if (!source.startsWith("@")) { @@ -42,3 +44,6 @@ inline fun mention(vararg parts: TextSource) = mention(parts.toList()) @Suppress("NOTHING_TO_INLINE") inline fun mention(whoToMention: String) = mention(regular(whoToMention)) +@Suppress("NOTHING_TO_INLINE") +inline fun mention(whoToMention: Username) = mention(whoToMention.username.dropWhile { it == '@' }) +