1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

TextedMediaGroupMediaInput

This commit is contained in:
InsanusMokrassar 2022-04-03 19:37:56 +06:00
parent 97d122c770
commit ee1c7c6533
6 changed files with 25 additions and 3 deletions

View File

@ -4,6 +4,7 @@
* `Core`:
* New type `TextedMediaContent` which will unite `TextedInput` and `MediaContent`
* New type `TextedMediaGroupMediaInput` which will unite `TextedMediaContent` and `MediaGroupContent`
* `MediaGroupContent` and all subsequent inheritors have been replaced to the package `dev.inmo.tgbotapi.types.message.content.media`
* Add `reply` functions with the texted content with including of text

View File

@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.types.InputMedia.AudioMediaGroupMemberInputMedia
import dev.inmo.tgbotapi.types.files.AudioFile
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
interface AudioMediaGroupContent : MediaGroupContent {
interface AudioMediaGroupContent : TextedMediaGroupMediaInput {
override val media: AudioFile
override fun toMediaGroupMemberInputMedia(): AudioMediaGroupMemberInputMedia

View File

@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.types.files.DocumentFile
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
import dev.inmo.tgbotapi.types.message.content.media.MediaGroupContent
interface DocumentMediaGroupContent : MediaGroupContent {
interface DocumentMediaGroupContent : TextedMediaGroupMediaInput {
override val media: DocumentFile
override fun toMediaGroupMemberInputMedia(): DocumentMediaGroupMemberInputMedia

View File

@ -0,0 +1,3 @@
package dev.inmo.tgbotapi.types.message.content.media
sealed interface TextedMediaGroupMediaInput : TextedMediaContent, MediaGroupContent

View File

@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.message.content.media
import dev.inmo.tgbotapi.types.InputMedia.VisualMediaGroupMemberInputMedia
interface VisualMediaGroupContent : MediaGroupContent {
interface VisualMediaGroupContent : TextedMediaGroupMediaInput {
override fun toMediaGroupMemberInputMedia(): VisualMediaGroupMemberInputMedia
}

View File

@ -8,6 +8,8 @@ import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.message.content.abstracts.*
import dev.inmo.tgbotapi.types.message.content.media.*
import dev.inmo.tgbotapi.types.message.content.media.MediaGroupContent
import dev.inmo.tgbotapi.types.message.content.media.VisualMediaGroupContent
import dev.inmo.tgbotapi.types.message.payments.InvoiceContent
import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.SentMediaGroupUpdate
import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
@ -203,6 +205,17 @@ fun FlowsUpdatesFilter.videoMessagesWithMediaGroups(
mediaGroupVideosMessages(scopeToIncludeChannels).flatMap()
)
fun Flow<BaseSentMessageUpdate>.textedMediaContentMessages() = filterContentMessages<TextedMediaContent>()
fun FlowsUpdatesFilter.textedMediaContentMessages(
scopeToIncludeChannels: CoroutineScope? = null
) = filterContentMessages<TextedMediaContent>(scopeToIncludeChannels)
fun FlowsUpdatesFilter.textedMediaContentMessagesWithMediaGroups(
scopeToIncludeChannels: CoroutineScope? = null
) = merge(
filterContentMessages<TextedMediaContent>(scopeToIncludeChannels),
mediaGroupTextedMediaGroupMediaInput(scopeToIncludeChannels).flatMap()
)
fun Flow<BaseSentMessageUpdate>.videoNoteMessages() = filterContentMessages<VideoNoteContent>()
fun FlowsUpdatesFilter.videoNoteMessages(
scopeToIncludeChannels: CoroutineScope? = null
@ -243,3 +256,8 @@ fun Flow<SentMediaGroupUpdate>.mediaGroupDocumentMessages() = filterMediaGroupMe
fun FlowsUpdatesFilter.mediaGroupDocumentMessages(
scopeToIncludeChannels: CoroutineScope? = null
) = filterMediaGroupMessages<DocumentContent>(scopeToIncludeChannels)
fun Flow<SentMediaGroupUpdate>.mediaGroupTextedMediaGroupMediaInput() = filterMediaGroupMessages<TextedMediaGroupMediaInput>()
fun FlowsUpdatesFilter.mediaGroupTextedMediaGroupMediaInput(
scopeToIncludeChannels: CoroutineScope? = null
) = filterMediaGroupMessages<TextedMediaGroupMediaInput>(scopeToIncludeChannels)