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

fix in SendMessage

This commit is contained in:
InsanusMokrassar 2020-05-31 22:51:42 +06:00
parent ec37df82a9
commit 35dcd6ada7
3 changed files with 7 additions and 2 deletions

View File

@ -51,6 +51,10 @@
### 0.27.5
* `TelegramotAPI`:
* Fix: `SendTextMessage` will correctly check the length of incoming text
* Constant `maxTextLength` was added
### 0.27.4
* `TelegramBotAPI-extensions-utils`:

View File

@ -36,8 +36,8 @@ data class SendTextMessage(
DisableWebPagePreview
{
init {
if (text.length !in textLength) {
throw IllegalArgumentException("Text must be in $textLength range")
if (text.length > maxTextLength) {
throw IllegalArgumentException("Text length must be less than $maxTextLength, but was ${text.length}")
}
}

View File

@ -28,6 +28,7 @@ val getUpdatesLimit = 1 .. 100
val callbackQueryAnswerLength = 0 until 200
val captionLength = 0 until 1024
val textLength = 0 until 4096
val maxTextLength = textLength.last + 1
val userProfilePhotosRequestLimit = 0 .. 100
val chatTitleLength = 1 until 255
val chatDescriptionLength = 0 until 256