mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
add several extension properties to texted/captioned/explained interfaces
This commit is contained in:
parent
3620350cc0
commit
d73fa4076f
@ -76,6 +76,7 @@
|
|||||||
formatter entities will use `RegularTextSource`
|
formatter entities will use `RegularTextSource`
|
||||||
* `MultilevelTextSource#textParts` has been deprecated. Now each `MultilevelTextSource` have its own
|
* `MultilevelTextSource#textParts` has been deprecated. Now each `MultilevelTextSource` have its own
|
||||||
`textSources` list
|
`textSources` list
|
||||||
|
* New dsl for creating of `TextSource` lists
|
||||||
* `API`:
|
* `API`:
|
||||||
* Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat`
|
* Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat`
|
||||||
* New extensions `TelegramBot#unpinAllChatMessages`
|
* New extensions `TelegramBot#unpinAllChatMessages`
|
||||||
|
@ -19,8 +19,16 @@ interface CaptionedInput : Captioned {
|
|||||||
val captionEntities: List<TextPart>
|
val captionEntities: List<TextPart>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CaptionedInput.captionEntities
|
||||||
|
* @see justTextSources
|
||||||
|
*/
|
||||||
|
val CaptionedInput.textSources
|
||||||
|
get() = captionEntities.justTextSources()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert its [CaptionedInput.captionEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
* Convert its [CaptionedInput.captionEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
||||||
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||||
*/
|
*/
|
||||||
|
@Deprecated("Currently list of entities already full. This method is redundant")
|
||||||
fun CaptionedInput.fullEntitiesList(): TextSourcesList = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()
|
fun CaptionedInput.fullEntitiesList(): TextSourcesList = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.CommonAbstracts
|
package dev.inmo.tgbotapi.CommonAbstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.FoursquareId
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.FoursquareType
|
|
||||||
import dev.inmo.tgbotapi.types.GooglePlaceId
|
|
||||||
import dev.inmo.tgbotapi.types.GooglePlaceType
|
|
||||||
|
|
||||||
interface CommonVenueData : Titled {
|
interface CommonVenueData : Titled {
|
||||||
override val title: String
|
override val title: String
|
||||||
|
@ -25,8 +25,16 @@ interface ExplainedInput : Explained {
|
|||||||
val explanationEntities: List<TextPart>
|
val explanationEntities: List<TextPart>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ExplainedInput.explanationEntities
|
||||||
|
* @see justTextSources
|
||||||
|
*/
|
||||||
|
val ExplainedInput.textSources
|
||||||
|
get() = explanationEntities.justTextSources()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert its [ExplainedInput.explanationEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
* Convert its [ExplainedInput.explanationEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
||||||
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||||
*/
|
*/
|
||||||
|
@Deprecated("Currently list of entities already full. This method is redundant")
|
||||||
fun ExplainedInput.fullEntitiesList(): TextSourcesList = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList()
|
fun ExplainedInput.fullEntitiesList(): TextSourcesList = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList()
|
||||||
|
@ -25,8 +25,16 @@ interface TextedInput : Texted {
|
|||||||
val textEntities: List<TextPart>
|
val textEntities: List<TextPart>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextedInput.textEntities
|
||||||
|
* @see justTextSources
|
||||||
|
*/
|
||||||
|
val TextedInput.textSources
|
||||||
|
get() = textEntities.justTextSources()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert its [TextedInput.textEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
* Convert its [TextedInput.textEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
||||||
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||||
*/
|
*/
|
||||||
|
@Deprecated("Currently list of entities already full. This method is redundant")
|
||||||
fun TextedInput.fullEntitiesList(): TextSourcesList = text ?.fullListOfSubSource(textEntities) ?.map { it.source } ?: emptyList()
|
fun TextedInput.fullEntitiesList(): TextSourcesList = text ?.fullListOfSubSource(textEntities) ?.map { it.source } ?: emptyList()
|
||||||
|
Loading…
Reference in New Issue
Block a user