mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-05 08:09:21 +00:00
add extensions splitFor(Text|Caption) and fix captionLength
This commit is contained in:
@@ -29808,6 +29808,8 @@ public final class dev/inmo/tgbotapi/utils/extensions/StringKt {
|
|||||||
public static final fun escapeMarkdownV2Common (Ljava/lang/String;)Ljava/lang/String;
|
public static final fun escapeMarkdownV2Common (Ljava/lang/String;)Ljava/lang/String;
|
||||||
public static final fun escapeMarkdownV2Link (Ljava/lang/String;)Ljava/lang/String;
|
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 escapeMarkdownV2PreAndCode (Ljava/lang/String;)Ljava/lang/String;
|
||||||
|
public static final fun splitForCaption (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 toHtml (Ljava/lang/String;)Ljava/lang/String;
|
||||||
public static final fun toMarkdown (Ljava/lang/String;)Ljava/lang/String;
|
public static final fun toMarkdown (Ljava/lang/String;)Ljava/lang/String;
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,7 @@ val horizontalAccuracyLimit = 0F .. 1500F
|
|||||||
|
|
||||||
val getUpdatesLimit = 1 .. 100
|
val getUpdatesLimit = 1 .. 100
|
||||||
val callbackQueryAnswerLength = 0 until 200
|
val callbackQueryAnswerLength = 0 until 200
|
||||||
val captionLength = 0 .. 1024
|
val captionLength = 0 .. 2048
|
||||||
val textLength = 1 .. 4096
|
val textLength = 1 .. 4096
|
||||||
val userProfilePhotosRequestLimit = 0 .. 100
|
val userProfilePhotosRequestLimit = 0 .. 100
|
||||||
val chatTitleLength = 1 until 255
|
val chatTitleLength = 1 until 255
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.utils.extensions
|
package dev.inmo.tgbotapi.utils.extensions
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.captionLength
|
||||||
|
import dev.inmo.tgbotapi.types.textLength
|
||||||
|
|
||||||
fun String.toMarkdown(): String {
|
fun String.toMarkdown(): String {
|
||||||
return replace(
|
return replace(
|
||||||
"*",
|
"*",
|
||||||
@@ -53,3 +56,6 @@ fun String.toHtml(): String = replace(
|
|||||||
"&",
|
"&",
|
||||||
"&"
|
"&"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun String.splitForText() = chunked(textLength.last)
|
||||||
|
fun String.splitForCaption() = chunked(captionLength.last)
|
||||||
|
Reference in New Issue
Block a user