mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-05-26 02:07:22 +00:00
fix checking of text length in SendMessageDraft
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send
|
package dev.inmo.tgbotapi.requests.send
|
||||||
|
|
||||||
|
import dev.inmo.kslog.common.w
|
||||||
import dev.inmo.tgbotapi.abstracts.TextedOutput
|
import dev.inmo.tgbotapi.abstracts.TextedOutput
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
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.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
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.extensions.makeString
|
||||||
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
|
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
|
||||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||||
@@ -73,8 +75,8 @@ data class SendMessageDraft internal constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (text.length !in textLength) {
|
if (text.length !in draftMessageTextLength) {
|
||||||
throwRangeError("Text length", textLength, text.length)
|
DefaultKTgBotAPIKSLog.w("For sendMessageDraft it is required to have length of text in range $draftMessageTextLength, but actual length is ${text.length}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ val getUpdatesLimit = 1 .. 100
|
|||||||
val callbackQueryAnswerLength = 0 until 200
|
val callbackQueryAnswerLength = 0 until 200
|
||||||
val captionLength = 0 .. 1024
|
val captionLength = 0 .. 1024
|
||||||
val storyCaptionLength = 0 .. 2048
|
val storyCaptionLength = 0 .. 2048
|
||||||
val textLength = 0 .. 4096
|
val textLength = 1 .. 4096
|
||||||
|
val draftMessageTextLength = 0 .. textLength.last
|
||||||
val userProfilePhotosRequestLimit = 1 .. 100
|
val userProfilePhotosRequestLimit = 1 .. 100
|
||||||
val userProfileAudiosRequestLimit = 1 .. 100
|
val userProfileAudiosRequestLimit = 1 .. 100
|
||||||
val chatTitleLength = 1 until 255
|
val chatTitleLength = 1 until 255
|
||||||
|
|||||||
Reference in New Issue
Block a user