1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +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 ## 0.25.0
* `TelegramBotAPI`:
* `Bot` implementations (as and `Bot` itself) now have not nullable `username`
## 0.24.0 ## 0.24.0
* `TelegramBotAPI`: * `TelegramBotAPI`:

View File

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