1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-22 16:47:13 +00:00

now bot username is not nullable

This commit is contained in:
InsanusMokrassar 2020-03-22 12:56:52 +06:00
parent 0b4b4950c2
commit a0120afb08
2 changed files with 11 additions and 6 deletions

View File

@ -2,6 +2,9 @@
## 0.25.0
* `TelegramBotAPI`:
* `Bot` implementations (as and `Bot` itself) now have not nullable `username`
## 0.24.0
* `TelegramBotAPI`:

View File

@ -22,17 +22,19 @@ data class CommonUser(
) : User()
@Serializable(UserSerializer::class)
sealed class Bot : User()
sealed class Bot : User() {
abstract override val username: Username
}
@Serializable
data class CommonBot(
override val id: ChatId,
@SerialName(usernameField)
override val username: Username,
@SerialName(firstNameField)
override val firstName: String,
@SerialName(lastNameField)
override val lastName: String = "",
@SerialName(usernameField)
override val username: Username? = null
override val lastName: String = ""
) : Bot() {
@SerialName(isBotField)
private val isBot = true
@ -41,12 +43,12 @@ data class CommonBot(
@Serializable
data class ExtendedBot(
override val id: ChatId,
@SerialName(usernameField)
override val username: Username,
@SerialName(firstNameField)
override val firstName: String,
@SerialName(lastNameField)
override val lastName: String = "",
@SerialName(usernameField)
override val username: Username? = null,
@SerialName(canJoinGroupsField)
val canJoinGroups: Boolean = false,
@SerialName(canReadAllGroupMessagesField)