diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 3f4c5a7ba6..2b3453a8a8 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -10187,9 +10187,9 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final fun getPollOptionTextLength ()Lkotlin/ranges/IntRange; public static final fun getPollOptionsLimit ()Lkotlin/ranges/IntRange; public static final fun getPollQuestionTextLength ()Lkotlin/ranges/IntRange; - public static final fun getPostCaptionLength ()Lkotlin/ranges/IntRange; public static final fun getSlotMachineDiceResultLimit ()Lkotlin/ranges/IntRange; public static final fun getStickerKeywordLengthLimit ()Lkotlin/ranges/IntRange; + public static final fun getStoryCaptionLength ()Lkotlin/ranges/IntRange; public static final fun getSuggestedTipAmountsLimit ()Lkotlin/ranges/IntRange; public static final fun getTelegramInlineModeGifPermittedMimeTypes ()Ljava/util/List; public static final fun getTextLength ()Lkotlin/ranges/IntRange; @@ -24372,6 +24372,7 @@ public final class dev/inmo/tgbotapi/types/message/textsources/TextSourceKt { public static final fun splitForCaption (Ljava/util/List;)Ljava/util/List; public static final fun splitForMessage (Ljava/util/List;Lkotlin/ranges/IntRange;Ljava/lang/Integer;)Ljava/util/List; public static synthetic fun splitForMessage$default (Ljava/util/List;Lkotlin/ranges/IntRange;Ljava/lang/Integer;ILjava/lang/Object;)Ljava/util/List; + public static final fun splitForStoryCaption (Ljava/util/List;)Ljava/util/List; public static final fun splitForText (Ljava/util/List;)Ljava/util/List; } @@ -29810,6 +29811,7 @@ public final class dev/inmo/tgbotapi/utils/extensions/StringKt { public static final fun escapeMarkdownV2Link (Ljava/lang/String;)Ljava/lang/String; public static final fun escapeMarkdownV2PreAndCode (Ljava/lang/String;)Ljava/lang/String; public static final fun splitForCaption (Ljava/lang/String;)Ljava/util/List; + public static final fun splitForStoryCaption (Ljava/lang/String;)Ljava/util/List; public static final fun splitForText (Ljava/lang/String;)Ljava/util/List; public static final fun toHtml (Ljava/lang/String;)Ljava/lang/String; public static final fun toMarkdown (Ljava/lang/String;)Ljava/lang/String; 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 472ce1954d..e8fdad6511 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 @@ -56,7 +56,7 @@ val horizontalAccuracyLimit = 0F .. 1500F val getUpdatesLimit = 1 .. 100 val callbackQueryAnswerLength = 0 until 200 val captionLength = 0 .. 1024 -val postCaptionLength = 0 .. 2048 +val storyCaptionLength = 0 .. 2048 val textLength = 1 .. 4096 val userProfilePhotosRequestLimit = 0 .. 100 val chatTitleLength = 1 until 255 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt index 12dcbbd071..e9d06ba110 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.message.textsources import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded import dev.inmo.tgbotapi.types.captionLength +import dev.inmo.tgbotapi.types.storyCaptionLength import dev.inmo.tgbotapi.types.textLength import kotlinx.serialization.Serializable @@ -90,7 +91,7 @@ fun List.splitForMessage(limit: IntRange, numberOfParts: Int? = null } /** - * This method will prepare [TextSource]s list for messages. Remember, that first part will be separated with + * This method will prepare [TextSource]s list for captions. Remember, that first part will be separated with * [captionLength] and all others with */ fun List.splitForCaption(): List> { @@ -98,6 +99,13 @@ fun List.splitForCaption(): List> { return listOf(captionPart) + minus(captionPart).splitForMessage(textLength) } +/** + * This method will prepare [TextSource]s list for stories + */ +fun List.splitForStoryCaption(): List> { + return splitForMessage(storyCaptionLength) +} + /** * This method will prepare [TextSource]s list for messages with [textLength] */ diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/String.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/String.kt index 869c922192..bf164c609b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/String.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/String.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.utils.extensions import dev.inmo.tgbotapi.types.captionLength +import dev.inmo.tgbotapi.types.storyCaptionLength import dev.inmo.tgbotapi.types.textLength fun String.toMarkdown(): String { @@ -59,3 +60,4 @@ fun String.toHtml(): String = replace( fun String.splitForText() = chunked(textLength.last) fun String.splitForCaption() = chunked(captionLength.last) +fun String.splitForStoryCaption() = chunked(storyCaptionLength.last)