mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
commit
f7be4e557e
16
CHANGELOG.md
16
CHANGELOG.md
@ -1,5 +1,21 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 6.0.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.7.22` -> `1.8.10`
|
||||||
|
* `MicroUtils`: `0.16.10` -> `0.17.0`
|
||||||
|
* `Serialization`: `1.4.1` -> `1.5.0`
|
||||||
|
* `uuid`: `0.6.0` -> `0.7.0`
|
||||||
|
* `Core`:
|
||||||
|
* `*.link` extensions have been deprecated with renaming to avoid collisions with `link` methods
|
||||||
|
* `API`:
|
||||||
|
* Add `TelegramBot.resend` methods
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Add triggers and waiters for `VisualMediaGroupPartContent`
|
||||||
|
* `Utils`:
|
||||||
|
* `*.link` extensions have been deprecated with renaming to avoid collisions with `link` methods
|
||||||
|
|
||||||
## 5.2.1
|
## 5.2.1
|
||||||
|
|
||||||
* `Core`:
|
* `Core`:
|
||||||
|
@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=5.2.1
|
library_version=6.0.0
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kotlin = "1.7.22"
|
kotlin = "1.8.10"
|
||||||
kotlin-serialization = "1.4.1"
|
kotlin-serialization = "1.5.0"
|
||||||
kotlin-coroutines = "1.6.4"
|
kotlin-coroutines = "1.6.4"
|
||||||
|
|
||||||
javax-activation = "1.1.1"
|
javax-activation = "1.1.1"
|
||||||
|
|
||||||
korlibs = "3.4.0"
|
korlibs = "3.4.0"
|
||||||
uuid = "0.6.0"
|
uuid = "0.7.0"
|
||||||
ktor = "2.2.3"
|
ktor = "2.2.3"
|
||||||
|
|
||||||
ksp = "1.7.22-1.0.8"
|
ksp = "1.8.10-1.0.9"
|
||||||
kotlin-poet = "1.12.0"
|
kotlin-poet = "1.12.0"
|
||||||
|
|
||||||
microutils = "0.16.10"
|
microutils = "0.17.0"
|
||||||
|
|
||||||
github-release-plugin = "2.4.1"
|
github-release-plugin = "2.4.1"
|
||||||
dokka = "1.7.20"
|
dokka = "1.7.20"
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
task javadocsJar(type: Jar) {
|
||||||
classifier = 'javadoc'
|
archiveClassifier.convention("javadoc")
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
@ -19,22 +20,22 @@ publishing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
developers {
|
developers {
|
||||||
|
|
||||||
developer {
|
developer {
|
||||||
id = "InsanusMokrassar"
|
id = "InsanusMokrassar"
|
||||||
name = "Ovsiannikov Aleksei"
|
name = "Ovsiannikov Aleksei"
|
||||||
email = "ovsyannikov.alexey95@gmail.com"
|
email = "ovsyannikov.alexey95@gmail.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
licenses {
|
licenses {
|
||||||
|
|
||||||
license {
|
license {
|
||||||
name = "Apache Software License 2.0"
|
name = "Apache Software License 2.0"
|
||||||
url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"
|
url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
@ -42,55 +43,55 @@ publishing {
|
|||||||
maven {
|
maven {
|
||||||
name = "GithubPackages"
|
name = "GithubPackages"
|
||||||
url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI")
|
url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI")
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
|
username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
|
||||||
password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
|
password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
|
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
|
||||||
maven {
|
maven {
|
||||||
name = "Gitea"
|
name = "Gitea"
|
||||||
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
||||||
|
|
||||||
credentials(HttpHeaderCredentials) {
|
credentials(HttpHeaderCredentials) {
|
||||||
name = "Authorization"
|
name = "Authorization"
|
||||||
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
||||||
}
|
}
|
||||||
|
|
||||||
authentication {
|
authentication {
|
||||||
header(HttpHeaderAuthentication)
|
header(HttpHeaderAuthentication)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||||
maven {
|
maven {
|
||||||
name = "sonatype"
|
name = "sonatype"
|
||||||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
||||||
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.hasProperty("signing.gnupg.keyName")) {
|
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
|
|
||||||
signing {
|
signing {
|
||||||
useGpgCmd()
|
useGpgCmd()
|
||||||
|
|
||||||
sign publishing.publications
|
sign publishing.publications
|
||||||
}
|
}
|
||||||
|
|
||||||
task signAll {
|
task signAll {
|
||||||
tasks.withType(Sign).forEach {
|
tasks.withType(Sign).forEach {
|
||||||
dependsOn(it)
|
dependsOn(it)
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.send
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will send [content] to the [chatId] as is
|
||||||
|
*/
|
||||||
|
suspend inline fun <T : MessageContent> TelegramBot.resend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
content: T,
|
||||||
|
messageThreadId: MessageThreadId? = chatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
content.createResend(
|
||||||
|
chatId = chatId,
|
||||||
|
messageThreadId = messageThreadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
replyToMessageId = replyToMessageId,
|
||||||
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
|
replyMarkup = replyMarkup
|
||||||
|
)
|
||||||
|
) as ContentMessage<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will send [content] to the [chatId] as is
|
||||||
|
*/
|
||||||
|
suspend inline fun <T : MessageContent> TelegramBot.resend(
|
||||||
|
chat: Chat,
|
||||||
|
content: T,
|
||||||
|
messageThreadId: MessageThreadId? = chat.id.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = resend(
|
||||||
|
chatId = chat.id,
|
||||||
|
content = content,
|
||||||
|
messageThreadId = messageThreadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
replyToMessageId = replyToMessageId,
|
||||||
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
|
replyMarkup = replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will send [message] content to the [chatId]. In difference with [copyMessage], this method will use
|
||||||
|
* native methods for data sending (like [dev.inmo.tgbotapi.extensions.api.send.media.sendPhoto] if inoming content is
|
||||||
|
* [dev.inmo.tgbotapi.types.message.content.PhotoContent])
|
||||||
|
*/
|
||||||
|
suspend inline fun <T : MessageContent> TelegramBot.resend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
message: ContentMessage<T>,
|
||||||
|
messageThreadId: MessageThreadId? = chatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = resend(
|
||||||
|
chatId = chatId,
|
||||||
|
content = message.content,
|
||||||
|
messageThreadId = messageThreadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
replyToMessageId = replyToMessageId,
|
||||||
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
|
replyMarkup = replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will send [message] content to the [chat]. In difference with [copyMessage], this method will use
|
||||||
|
* native methods for data sending (like [dev.inmo.tgbotapi.extensions.api.send.media.sendPhoto] if inoming content is
|
||||||
|
* [dev.inmo.tgbotapi.types.message.content.PhotoContent])
|
||||||
|
*/
|
||||||
|
suspend inline fun <T : MessageContent> TelegramBot.resend(
|
||||||
|
chat: Chat,
|
||||||
|
message: ContentMessage<T>,
|
||||||
|
messageThreadId: MessageThreadId? = chat.id.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = resend(
|
||||||
|
chatId = chat.id,
|
||||||
|
message = message,
|
||||||
|
messageThreadId = messageThreadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
replyToMessageId = replyToMessageId,
|
||||||
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
|
replyMarkup = replyMarkup
|
||||||
|
)
|
@ -189,3 +189,7 @@ suspend fun BehaviourContext.waitInvoice(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<InvoiceContent>(initRequest, errorFactory)
|
) = waitContent<InvoiceContent>(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitVisualContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||||
|
@ -216,3 +216,8 @@ suspend fun BehaviourContext.waitInvoiceMessage(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<InvoiceContent>(initRequest, errorFactory)
|
) = waitContentMessage<InvoiceContent>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitVisualContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||||
|
@ -607,3 +607,27 @@ suspend fun <BC : BehaviourContext> BC.onInvoice(
|
|||||||
markerFactory,
|
markerFactory,
|
||||||
scenarioReceiver
|
scenarioReceiver
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onVisualContent(
|
||||||
|
initialFilter: CommonMessageFilter<VisualMediaGroupPartContent>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VisualMediaGroupMessage, Update> = MessageFilterByChat,
|
||||||
|
markerFactory: MarkerFactory<in VisualMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VisualMediaGroupMessage>
|
||||||
|
) = onContentMessageWithType(
|
||||||
|
initialFilter,
|
||||||
|
subcontextUpdatesFilter,
|
||||||
|
markerFactory,
|
||||||
|
scenarioReceiver
|
||||||
|
)
|
||||||
|
@ -74,8 +74,11 @@ val Identifier.userLink: String
|
|||||||
@Warning("This API have restrictions in Telegram System")
|
@Warning("This API have restrictions in Telegram System")
|
||||||
val UserId.userLink: String
|
val UserId.userLink: String
|
||||||
get() = chatId.userLink
|
get() = chatId.userLink
|
||||||
val User.link: String
|
val User.userLink: String
|
||||||
get() = id.userLink
|
get() = id.userLink
|
||||||
|
@Deprecated("Deprecated due to the conflicts in name", ReplaceWith("this.userLink", "dev.inmo.tgbotapi.types.userLink"))
|
||||||
|
val User.link: String
|
||||||
|
get() = userLink
|
||||||
|
|
||||||
typealias UserId = ChatId
|
typealias UserId = ChatId
|
||||||
|
|
||||||
|
@ -18,10 +18,16 @@ fun makeChatLink(identifier: Identifier, threadId: MessageThreadId? = null) = id
|
|||||||
fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start="
|
fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start="
|
||||||
fun makeUsernameStartattachPrefix(username: String) = "$internalLinkBeginning/$username?startattach"
|
fun makeUsernameStartattachPrefix(username: String) = "$internalLinkBeginning/$username?startattach"
|
||||||
fun makeUsernameStartattachLink(username: String, data: String? = null) = "${makeUsernameStartattachPrefix(username)}${data?.let { "=$it" } ?: ""}"
|
fun makeUsernameStartattachLink(username: String, data: String? = null) = "${makeUsernameStartattachPrefix(username)}${data?.let { "=$it" } ?: ""}"
|
||||||
inline val Username.link
|
inline val Username.usernameLink
|
||||||
get() = makeUsernameLink(usernameWithoutAt)
|
get() = makeUsernameLink(usernameWithoutAt)
|
||||||
val IdChatIdentifier.link: String
|
@Deprecated("Deprecated due to the conflicts in name", ReplaceWith("this.usernameLink", "dev.inmo.tgbotapi.extensions.utils.formatting.usernameLink"))
|
||||||
|
inline val Username.link
|
||||||
|
get() = usernameLink
|
||||||
|
val IdChatIdentifier.chatLink: String
|
||||||
get() = makeChatLink(chatId, threadId)
|
get() = makeChatLink(chatId, threadId)
|
||||||
|
@Deprecated("Deprecated due to the conflicts in name", ReplaceWith("this.chatLink", "dev.inmo.tgbotapi.extensions.utils.formatting.chatLink"))
|
||||||
|
val IdChatIdentifier.link: String
|
||||||
|
get() = chatLink
|
||||||
fun ChatId.link(threadId: MessageThreadId?) = makeChatLink(chatId, threadId)
|
fun ChatId.link(threadId: MessageThreadId?) = makeChatLink(chatId, threadId)
|
||||||
inline fun Username.link(threadId: MessageThreadId?) = makeUsernameLink(usernameWithoutAt, threadId)
|
inline fun Username.link(threadId: MessageThreadId?) = makeUsernameLink(usernameWithoutAt, threadId)
|
||||||
inline val Username.deepLinkPrefix
|
inline val Username.deepLinkPrefix
|
||||||
@ -83,20 +89,27 @@ fun makeLinkToMessage(
|
|||||||
/**
|
/**
|
||||||
* @see makeLinkToMessage
|
* @see makeLinkToMessage
|
||||||
*/
|
*/
|
||||||
val Message.link: String?
|
val Message.messageLink: String?
|
||||||
get() = makeLinkToMessage(
|
get() = makeLinkToMessage(
|
||||||
chat,
|
chat,
|
||||||
messageId
|
messageId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see makeLinkToMessage
|
||||||
|
*/
|
||||||
|
@Deprecated("Deprecated due to the conflicts in name", ReplaceWith("this.messageLink", "dev.inmo.tgbotapi.extensions.utils.formatting.messageLink"))
|
||||||
|
val Message.link: String?
|
||||||
|
get() = messageLink
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Link which can be used as by any user to get access to [Chat]. Returns null in case when there are no
|
* Link which can be used as by any user to get access to [Chat]. Returns null in case when there are no
|
||||||
* known way to build link
|
* known way to build link
|
||||||
*/
|
*/
|
||||||
val Chat.link: String?
|
val Chat.chatLink: String?
|
||||||
get() {
|
get() {
|
||||||
if (this is UsernameChat) {
|
if (this is UsernameChat) {
|
||||||
username ?.link ?: id.link
|
username ?.usernameLink ?: id.chatLink
|
||||||
}
|
}
|
||||||
if (this is ExtendedPublicChat) {
|
if (this is ExtendedPublicChat) {
|
||||||
inviteLink ?.let { return it }
|
inviteLink ?.let { return it }
|
||||||
@ -107,6 +120,14 @@ val Chat.link: String?
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link which can be used as by any user to get access to [Chat]. Returns null in case when there are no
|
||||||
|
* known way to build link
|
||||||
|
*/
|
||||||
|
@Deprecated("Deprecated due to the conflicts in name", ReplaceWith("this.chatLink", "dev.inmo.tgbotapi.extensions.utils.formatting.chatLink"))
|
||||||
|
val Chat.link: String?
|
||||||
|
get() = chatLink
|
||||||
|
|
||||||
private const val stickerSetAddingLinkPrefix = "$internalLinkBeginning/addstickers"
|
private const val stickerSetAddingLinkPrefix = "$internalLinkBeginning/addstickers"
|
||||||
|
|
||||||
val StickerSetName.stickerSetLink
|
val StickerSetName.stickerSetLink
|
||||||
|
Loading…
Reference in New Issue
Block a user