improvements in Username

This commit is contained in:
InsanusMokrassar committed 2024-01-07 21:56:31 +06:00
1 parent e28f3492ef
commit 60e50f9492
2 files changed
+14 -10

No files matched your search

@@ -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("@")) {