1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-05-22 00:07:23 +00:00

fix checking of text length in SendMessageDraft

This commit is contained in:
2026-05-20 17:59:46 +06:00
parent 631a4f16bd
commit dd35631345
2 changed files with 6 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.requests.send
import dev.inmo.kslog.common.w
import dev.inmo.tgbotapi.abstracts.TextedOutput
import dev.inmo.tgbotapi.requests.send.abstracts.*
import dev.inmo.tgbotapi.types.*
@@ -12,6 +13,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
import dev.inmo.tgbotapi.utils.extensions.makeString
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import dev.inmo.tgbotapi.utils.throwRangeError
@@ -73,8 +75,8 @@ data class SendMessageDraft internal constructor(
}
init {
if (text.length !in textLength) {
throwRangeError("Text length", textLength, text.length)
if (text.length !in draftMessageTextLength) {
DefaultKTgBotAPIKSLog.w("For sendMessageDraft it is required to have length of text in range $draftMessageTextLength, but actual length is ${text.length}")
}
}

View File

@@ -62,7 +62,8 @@ val getUpdatesLimit = 1 .. 100
val callbackQueryAnswerLength = 0 until 200
val captionLength = 0 .. 1024
val storyCaptionLength = 0 .. 2048
val textLength = 0 .. 4096
val textLength = 1 .. 4096
val draftMessageTextLength = 0 .. textLength.last
val userProfilePhotosRequestLimit = 1 .. 100
val userProfileAudiosRequestLimit = 1 .. 100
val chatTitleLength = 1 until 255