mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-04 15:33:47 +00:00
hotfix
This commit is contained in:
parent
d330cd2bfc
commit
f99873dd70
@ -15,6 +15,7 @@ fun makeLinkToMessage(
|
|||||||
): String = "$internalLinkBeginning/$username/$messageId"
|
): String = "$internalLinkBeginning/$username/$messageId"
|
||||||
|
|
||||||
private val linkIdRedundantPartRegex = Regex("^-100")
|
private val linkIdRedundantPartRegex = Regex("^-100")
|
||||||
|
private val usernameBeginSymbolRegex = Regex("^@")
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
fun makeLinkToMessage(
|
fun makeLinkToMessage(
|
||||||
@ -22,7 +23,9 @@ fun makeLinkToMessage(
|
|||||||
messageId: MessageIdentifier
|
messageId: MessageIdentifier
|
||||||
): String? {
|
): String? {
|
||||||
return when {
|
return when {
|
||||||
chat is UsernameChat && chat.username != null -> "$internalLinkBeginning/${chat.username ?.username}/$messageId"
|
chat is UsernameChat && chat.username != null -> {
|
||||||
|
"$internalLinkBeginning/${chat.username ?.username ?.replace(usernameBeginSymbolRegex, "")}/$messageId"
|
||||||
|
}
|
||||||
chat !is PrivateChat -> chat.id.chatId.toString().replace(
|
chat !is PrivateChat -> chat.id.chatId.toString().replace(
|
||||||
linkIdRedundantPartRegex,
|
linkIdRedundantPartRegex,
|
||||||
""
|
""
|
||||||
|
Loading…
Reference in New Issue
Block a user