mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
FullTextSourcesList
This commit is contained in:
parent
76b25d719a
commit
b336b17eef
@ -60,6 +60,9 @@
|
||||
* `explanationLimit` range was added as future replacement of `quizPollExplanationLimit`
|
||||
* `quizPollExplanationLimit` now is deprecated
|
||||
* Extensions `toMarkdownExplanations`, `toMarkdownV2Explanations` and `toHtmlExplanations` was added
|
||||
* Typealias `FullTextSourcesList` was added
|
||||
* All extensions `fullEntitiesList` now return `FullTextSourcesList`
|
||||
* All extensions of `List<TextSource>` now are extensions for `FullTextSourcesList`
|
||||
* `TelegramBotAPI-extensions-api`:
|
||||
* `sendQuizPoll` now is using `explanation` parameter instead of `caption`
|
||||
|
||||
|
@ -15,4 +15,4 @@ interface CaptionedInput : Captioned {
|
||||
val captionEntities: List<TextPart>
|
||||
}
|
||||
|
||||
fun CaptionedInput.fullEntitiesList() = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()
|
||||
fun CaptionedInput.fullEntitiesList(): FullTextSourcesList = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()
|
||||
|
@ -15,4 +15,4 @@ interface ExplainedInput : Explained {
|
||||
val explanationEntities: List<TextPart>
|
||||
}
|
||||
|
||||
fun ExplainedInput.fullEntitiesList() = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList()
|
||||
fun ExplainedInput.fullEntitiesList(): FullTextSourcesList = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList()
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||
|
||||
typealias FullTextSourcesList = List<TextSource>
|
||||
typealias FullTextPartsList = List<TextPart>
|
||||
|
||||
interface TextSource {
|
||||
val asMarkdownSource: String
|
||||
val asMarkdownV2Source: String
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.FullTextSourcesList
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendTextMessage
|
||||
@ -66,4 +67,4 @@ data class TextContent(
|
||||
}
|
||||
}
|
||||
|
||||
fun TextContent.fullEntitiesList() = text.fullListOfSubSource(entities).map { it.source }
|
||||
fun TextContent.fullEntitiesList(): FullTextSourcesList = text.fullListOfSubSource(entities).map { it.source }
|
||||
|
@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextCont
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.fullEntitiesList
|
||||
|
||||
fun createFormattedText(
|
||||
entities: List<TextSource>,
|
||||
entities: FullTextSourcesList,
|
||||
partLength: Int = 4096,
|
||||
mode: ParseMode = MarkdownParseMode
|
||||
): List<String> {
|
||||
@ -48,23 +48,23 @@ fun createFormattedText(
|
||||
|
||||
|
||||
fun createMarkdownText(
|
||||
entities: List<TextSource>,
|
||||
entities: FullTextSourcesList,
|
||||
partLength: Int = 4096
|
||||
): List<String> = createFormattedText(entities, partLength, MarkdownParseMode)
|
||||
|
||||
fun List<TextSource>.toMarkdownCaptions(): List<String> = createMarkdownText(
|
||||
fun FullTextSourcesList.toMarkdownCaptions(): List<String> = createMarkdownText(
|
||||
this,
|
||||
captionLength.last + 1
|
||||
)
|
||||
fun CaptionedInput.toMarkdownCaptions(): List<String> = fullEntitiesList().toMarkdownCaptions()
|
||||
|
||||
fun List<TextSource>.toMarkdownTexts(): List<String> = createMarkdownText(
|
||||
fun FullTextSourcesList.toMarkdownTexts(): List<String> = createMarkdownText(
|
||||
this,
|
||||
textLength.last + 1
|
||||
)
|
||||
fun TextContent.toMarkdownTexts(): List<String> = fullEntitiesList().toMarkdownTexts()
|
||||
|
||||
fun List<TextSource>.toMarkdownExplanations(): List<String> = createMarkdownText(
|
||||
fun FullTextSourcesList.toMarkdownExplanations(): List<String> = createMarkdownText(
|
||||
this,
|
||||
explanationLimit.last + 1
|
||||
)
|
||||
@ -72,23 +72,23 @@ fun ExplainedInput.toMarkdownExplanations(): List<String> = fullEntitiesList().t
|
||||
|
||||
|
||||
fun createMarkdownV2Text(
|
||||
entities: List<TextSource>,
|
||||
entities: FullTextSourcesList,
|
||||
partLength: Int = 4096
|
||||
): List<String> = createFormattedText(entities, partLength, MarkdownV2ParseMode)
|
||||
|
||||
fun List<TextSource>.toMarkdownV2Captions(): List<String> = createMarkdownV2Text(
|
||||
fun FullTextSourcesList.toMarkdownV2Captions(): List<String> = createMarkdownV2Text(
|
||||
this,
|
||||
captionLength.last + 1
|
||||
)
|
||||
fun CaptionedInput.toMarkdownV2Captions(): List<String> = fullEntitiesList().toMarkdownV2Captions()
|
||||
|
||||
fun List<TextSource>.toMarkdownV2Texts(): List<String> = createMarkdownV2Text(
|
||||
fun FullTextSourcesList.toMarkdownV2Texts(): List<String> = createMarkdownV2Text(
|
||||
this,
|
||||
textLength.last + 1
|
||||
)
|
||||
fun TextContent.toMarkdownV2Texts(): List<String> = fullEntitiesList().toMarkdownV2Texts()
|
||||
|
||||
fun List<TextSource>.toMarkdownV2Explanations(): List<String> = createMarkdownV2Text(
|
||||
fun FullTextSourcesList.toMarkdownV2Explanations(): List<String> = createMarkdownV2Text(
|
||||
this,
|
||||
explanationLimit.last + 1
|
||||
)
|
||||
@ -96,23 +96,23 @@ fun ExplainedInput.toMarkdownV2Explanations(): List<String> = fullEntitiesList()
|
||||
|
||||
|
||||
fun createHtmlText(
|
||||
entities: List<TextSource>,
|
||||
entities: FullTextSourcesList,
|
||||
partLength: Int = 4096
|
||||
): List<String> = createFormattedText(entities, partLength, HTMLParseMode)
|
||||
|
||||
fun List<TextSource>.toHtmlCaptions(): List<String> = createHtmlText(
|
||||
fun FullTextSourcesList.toHtmlCaptions(): List<String> = createHtmlText(
|
||||
this,
|
||||
captionLength.last + 1
|
||||
)
|
||||
fun CaptionedInput.toHtmlCaptions(): List<String> = fullEntitiesList().toHtmlCaptions()
|
||||
|
||||
fun List<TextSource>.toHtmlTexts(): List<String> = createHtmlText(
|
||||
fun FullTextSourcesList.toHtmlTexts(): List<String> = createHtmlText(
|
||||
this,
|
||||
textLength.last + 1
|
||||
)
|
||||
fun TextContent.toHtmlTexts(): List<String> = fullEntitiesList().toHtmlTexts()
|
||||
|
||||
fun List<TextSource>.toHtmlExplanations(): List<String> = createHtmlText(
|
||||
fun FullTextSourcesList.toHtmlExplanations(): List<String> = createHtmlText(
|
||||
this,
|
||||
explanationLimit.last + 1
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user