1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-03 07:09:23 +00:00

fixes in startGettingUpdates

This commit is contained in:
2020-03-31 11:28:48 +06:00
parent ee1f115d77
commit 43ac09a79b
5 changed files with 31 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ private val updatesListSerializer = ListSerializer(
@Serializable
data class GetUpdates(
val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
val limit: Int? = null,
val limit: Int = getUpdatesLimit.last,
val timeout: Seconds? = null,
val allowed_updates: List<String>? = ALL_UPDATES_LIST
): SimpleRequest<List<Update>> {
@@ -25,4 +25,10 @@ data class GetUpdates(
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
init {
if (limit !in getUpdatesLimit) {
error("GetUpdates request can be called only with limit in range $getUpdatesLimit (actual value is $limit)")
}
}
}

View File

@@ -23,6 +23,7 @@ typealias DiceResult = Int
typealias Seconds = Int
val getUpdatesLimit = 1 .. 100
val callbackQueryAnswerLength = 0 until 200
val captionLength = 0 until 1024
val textLength = 0 until 4096