1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-24 11:08:43 +00:00

fixes in webappuser

This commit is contained in:
InsanusMokrassar 2023-07-01 14:32:58 +06:00
parent 77ea1f741e
commit 187f340e88

View File

@ -27,18 +27,18 @@ val WebAppUser.isPremium
fun WebAppUser.asUser() = if (isBot == true) {
CommonBot(
UserId(id),
firstName,
lastName ?: "",
username ?.let(::Username) ?: error("Username is absent for bot, but must exists")
id = UserId(id),
firstName = firstName,
lastName = lastName ?: "",
username = username ?.let(::Username)
)
} else {
CommonUser(
UserId(id),
firstName,
lastName ?: "",
username ?.let(::Username),
languageCode ?.let(::IetfLanguageCode),
id = UserId(id),
firstName = firstName,
lastName = lastName ?: "",
username = username ?.let(::Username),
ietfLanguageCode = languageCode ?.let(::IetfLanguageCode),
isPremium = isPremium
)
}