diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessageDraft.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessageDraft.kt index cb72bb8bd0..b492015a0f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessageDraft.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessageDraft.kt @@ -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}") } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index 9641af3309..859984e9dd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -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