1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-24 19:18:44 +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) { fun WebAppUser.asUser() = if (isBot == true) {
CommonBot( CommonBot(
UserId(id), id = UserId(id),
firstName, firstName = firstName,
lastName ?: "", lastName = lastName ?: "",
username ?.let(::Username) ?: error("Username is absent for bot, but must exists") username = username ?.let(::Username)
) )
} else { } else {
CommonUser( CommonUser(
UserId(id), id = UserId(id),
firstName, firstName = firstName,
lastName ?: "", lastName = lastName ?: "",
username ?.let(::Username), username = username ?.let(::Username),
languageCode ?.let(::IetfLanguageCode), ietfLanguageCode = languageCode ?.let(::IetfLanguageCode),
isPremium = isPremium isPremium = isPremium
) )
} }