1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-04 07:39:39 +00:00

complete story support

This commit is contained in:
2023-08-19 16:41:08 +06:00
parent a65971be00
commit 6873c23309
7 changed files with 49 additions and 0 deletions

View File

@@ -292,6 +292,7 @@ import dev.inmo.tgbotapi.types.message.content.ResendableContent
import dev.inmo.tgbotapi.types.message.content.SpoilerableMediaContent
import dev.inmo.tgbotapi.types.message.content.StaticLocationContent
import dev.inmo.tgbotapi.types.message.content.StickerContent
import dev.inmo.tgbotapi.types.message.content.StoryContent
import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.content.TextedContent
import dev.inmo.tgbotapi.types.message.content.TextedMediaContent
@@ -3480,6 +3481,15 @@ public inline fun ResendableContent.stickerContentOrThrow(): StickerContent = th
public inline fun <T> ResendableContent.ifStickerContent(block: (StickerContent) -> T): T? =
stickerContentOrNull() ?.let(block)
public inline fun ResendableContent.storyContentOrNull(): StoryContent? = this as?
dev.inmo.tgbotapi.types.message.content.StoryContent
public inline fun ResendableContent.storyContentOrThrow(): StoryContent = this as
dev.inmo.tgbotapi.types.message.content.StoryContent
public inline fun <T> ResendableContent.ifStoryContent(block: (StoryContent) -> T): T? =
storyContentOrNull() ?.let(block)
public inline fun ResendableContent.textContentOrNull(): TextContent? = this as?
dev.inmo.tgbotapi.types.message.content.TextContent

View File

@@ -21,6 +21,7 @@ fun Flow<ContentMessage<*>>.onlyPhotoContentMessages() = withContentType<PhotoCo
fun Flow<ContentMessage<*>>.onlyPollContentMessages() = withContentType<PollContent>()
fun Flow<ContentMessage<*>>.onlyStickerContentMessages() = withContentType<StickerContent>()
fun Flow<ContentMessage<*>>.onlyTextContentMessages() = withContentType<TextContent>()
fun Flow<ContentMessage<*>>.onlyStoryContentMessages() = withContentType<StoryContent>()
fun Flow<ContentMessage<*>>.onlyVenueContentMessages() = withContentType<VenueContent>()
fun Flow<ContentMessage<*>>.onlyVideoContentMessages() = withContentType<VideoContent>()
fun Flow<ContentMessage<*>>.onlyVideoNoteContentMessages() = withContentType<VideoNoteContent>()

View File

@@ -120,6 +120,11 @@ fun FlowsUpdatesFilter.textMessages(
scopeToIncludeChannels: CoroutineScope? = null
) = filterContentMessages<TextContent>(scopeToIncludeChannels)
fun Flow<BaseSentMessageUpdate>.storyMessages() = filterContentMessages<StoryContent>()
fun FlowsUpdatesFilter.storyMessages(
scopeToIncludeChannels: CoroutineScope? = null
) = filterContentMessages<StoryContent>(scopeToIncludeChannels)
fun Flow<BaseSentMessageUpdate>.venueMessages() = filterContentMessages<VenueContent>()
fun FlowsUpdatesFilter.venueMessages(
scopeToIncludeChannels: CoroutineScope? = null