mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
*.link renames
This commit is contained in:
parent
c30ce5c803
commit
9ef1b54ada
@ -2,10 +2,14 @@
|
||||
|
||||
## 6.0.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
|
||||
|
||||
|
@ -74,8 +74,11 @@ val Identifier.userLink: String
|
||||
@Warning("This API have restrictions in Telegram System")
|
||||
val UserId.userLink: String
|
||||
get() = chatId.userLink
|
||||
val User.link: String
|
||||
val User.userLink: String
|
||||
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
|
||||
|
||||
|
@ -18,10 +18,16 @@ fun makeChatLink(identifier: Identifier, threadId: MessageThreadId? = null) = id
|
||||
fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start="
|
||||
fun makeUsernameStartattachPrefix(username: String) = "$internalLinkBeginning/$username?startattach"
|
||||
fun makeUsernameStartattachLink(username: String, data: String? = null) = "${makeUsernameStartattachPrefix(username)}${data?.let { "=$it" } ?: ""}"
|
||||
inline val Username.link
|
||||
inline val Username.usernameLink
|
||||
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)
|
||||
@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)
|
||||
inline fun Username.link(threadId: MessageThreadId?) = makeUsernameLink(usernameWithoutAt, threadId)
|
||||
inline val Username.deepLinkPrefix
|
||||
@ -83,20 +89,27 @@ fun makeLinkToMessage(
|
||||
/**
|
||||
* @see makeLinkToMessage
|
||||
*/
|
||||
val Message.link: String?
|
||||
val Message.messageLink: String?
|
||||
get() = makeLinkToMessage(
|
||||
chat,
|
||||
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
|
||||
* known way to build link
|
||||
*/
|
||||
val Chat.link: String?
|
||||
val Chat.chatLink: String?
|
||||
get() {
|
||||
if (this is UsernameChat) {
|
||||
username ?.link ?: id.link
|
||||
username ?.usernameLink ?: id.chatLink
|
||||
}
|
||||
if (this is ExtendedPublicChat) {
|
||||
inviteLink ?.let { return it }
|
||||
@ -107,6 +120,14 @@ val Chat.link: String?
|
||||
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"
|
||||
|
||||
val StickerSetName.stickerSetLink
|
||||
|
Loading…
Reference in New Issue
Block a user