mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 15:19:30 +00:00
more improvements :)
This commit is contained in:
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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<TextSource>.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<TextSource>.splitForCaption(): List<List<TextSource>> {
|
||||
@@ -98,6 +99,13 @@ fun List<TextSource>.splitForCaption(): List<List<TextSource>> {
|
||||
return listOf(captionPart) + minus(captionPart).splitForMessage(textLength)
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will prepare [TextSource]s list for stories
|
||||
*/
|
||||
fun List<TextSource>.splitForStoryCaption(): List<List<TextSource>> {
|
||||
return splitForMessage(storyCaptionLength)
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will prepare [TextSource]s list for messages with [textLength]
|
||||
*/
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user