mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
BotCommand checks
This commit is contained in:
parent
e85d5df03e
commit
a6aa4b8758
@ -40,6 +40,9 @@
|
||||
|
||||
### 0.26.1
|
||||
|
||||
* `TelegramBotAPI`:
|
||||
* `BotCommand` now will check and throw error in case when command or description lengths is/are incorrect
|
||||
|
||||
## 0.25.0
|
||||
|
||||
* Common:
|
||||
|
@ -9,4 +9,13 @@ data class BotCommand(
|
||||
val command: String,
|
||||
@SerialName(descriptionField)
|
||||
val description: String
|
||||
)
|
||||
) {
|
||||
init {
|
||||
if (command.length !in botCommandLengthLimit) {
|
||||
error("Command size must be in range $botCommandLengthLimit, but actually have length ${command.length}")
|
||||
}
|
||||
if (description.length !in botCommandDescriptionLimit) {
|
||||
error("Command description size must be in range $botCommandDescriptionLimit, but actually have length ${description.length}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ val customTitleLength = 0 .. 16
|
||||
|
||||
val diceResultLimit = 1 .. 6
|
||||
|
||||
val botCommandLimit = 1 .. 32
|
||||
val botCommandLengthLimit = 1 .. 32
|
||||
val botCommandLimit = botCommandLengthLimit
|
||||
val botCommandDescriptionLimit = 3 .. 256
|
||||
val botCommandsLimit = 0 .. 100
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user