From b2bc47ec047183ccf2b6cc2fe5bddf69a213b3bb Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 7 Feb 2022 18:00:13 +0600 Subject: [PATCH 1/3] start 0.38.5 --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9cb237d0f..245dfe7b01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # TelegramBotAPI changelog +## 0.38.5 + ## 0.38.4 __This update contains including of [Telegram Bot API 5.7](https://core.telegram.org/bots/api-changelog#january-31-2022)__ diff --git a/gradle.properties b/gradle.properties index d54183efd5..8abd07e2a6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,6 +20,6 @@ javax_activation_version=1.1.1 dokka_version=1.6.10 library_group=dev.inmo -library_version=0.38.4 +library_version=0.38.5 github_release_plugin_version=2.2.12 From 1ebaa1c38739acb07f0729627864c6c8e3ae956a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 7 Feb 2022 18:08:06 +0600 Subject: [PATCH 2/3] deeplinking fixes and additions --- CHANGELOG.md | 8 ++++++++ .../kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt | 3 +++ .../extensions/utils/formatting/LinksFormatting.kt | 8 +++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 245dfe7b01..9fbd7a8fe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## 0.38.5 +* `Core`: + * `Username` got new property `usernameWithoutAt` which will return `username` without leading `@` +* `Utils`: + * Several new functions for working with deep links: + * `makeUsernameDeepLinkPrefix` + * `makeTelegramDeepLink` + * `makeDeepLink` + ## 0.38.4 __This update contains including of [Telegram Bot API 5.7](https://core.telegram.org/bots/api-changelog#january-31-2022)__ diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt index cf3f5c256b..9d0ba534b5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt @@ -46,6 +46,9 @@ fun Byte.toChatId(): ChatId = toLong().toChatId() data class Username( val username: String ) : ChatIdentifier() { + val usernameWithoutAt + get() = username.dropWhile { it == '@' } + init { if (!username.startsWith("@")) { throw IllegalArgumentException("Username must starts with `@`") 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 8d7e2687d6..cffa0cd74f 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 @@ -9,9 +9,15 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message private const val internalLinkBeginning = "https://t.me" fun makeUsernameLink(username: String) = "$internalLinkBeginning/$username" +fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start=" inline val Username.link - get() = makeUsernameLink(username) + get() = makeUsernameLink(usernameWithoutAt) +inline val Username.deepLinkPrefix + get() = makeUsernameDeepLinkPrefix(usernameWithoutAt) inline fun makeLink(username: Username) = username.link +inline fun makeTelegramDeepLink(username: String, startParameter: String) = "${makeUsernameDeepLinkPrefix(username)}$startParameter" +inline fun makeDeepLink(username: Username, startParameter: String) = "${username.deepLinkPrefix}$startParameter" +inline fun makeTelegramDeepLink(username: Username, startParameter: String) = makeDeepLink(username, startParameter) fun makeLinkToMessage( username: String, From 1238843bdef310aefcd0eb638ef0e5ca0a0ecdb7 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 8 Feb 2022 16:50:38 +0600 Subject: [PATCH 3/3] update dependencies --- CHANGELOG.md | 3 +++ gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fbd7a8fe6..1a9dec1e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.38.5 +* `Common`: + * `Version`: + * `MicroUtils`: `0.9.5` -> `0.9.6` * `Core`: * `Username` got new property `usernameWithoutAt` which will return `username` without leading `@` * `Utils`: diff --git a/gradle.properties b/gradle.properties index 8abd07e2a6..3e281dc024 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ klock_version=2.4.13 uuid_version=0.4.0 ktor_version=1.6.7 -micro_utils_version=0.9.5 +micro_utils_version=0.9.6 javax_activation_version=1.1.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6b7fd26c83..7645e290ee 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip