1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-14 21:00:15 +00:00

improvements in Username

This commit is contained in:
2024-01-07 21:56:31 +06:00
parent e28f3492ef
commit 60e50f9492
2 changed files with 14 additions and 10 deletions

View File

@@ -87,12 +87,16 @@ fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId()
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
value class Username(
@Deprecated("Renamed", ReplaceWith("full"))
val username: String
) : ChatIdentifier {
val usernameWithoutAt
get() = username.dropWhile { it == '@' }
val full: String
get() = username
val withoutAt
get() = full.dropWhile { it == '@' }
@Deprecated("Renamed", ReplaceWith("withoutAt"))
val usernameWithoutAt
get() = withoutAt
init {
if (!username.startsWith("@")) {