commonMain.com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates.BaseMessagesUpdatesConversations.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of TelegramBotAPI-extensions-utils-js Show documentation
Show all versions of TelegramBotAPI-extensions-utils-js Show documentation
Util extensions for more useful work with updates and other things
The newest version!
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.*
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filterIsInstance
fun Flow.onlyBaseMessageUpdates(): Flow = filterIsInstance()
/**
* Converts flow to [Flow] of [BaseSentMessageUpdate]
*/
fun Flow.onlySentMessageUpdates(): Flow = filterIsInstance()
/**
* Converts flow to [Flow] of [BaseSentMessageUpdate]
*/
fun Flow.onlyEditMessageUpdates(): Flow = filterIsInstance()
/**
* Converts flow to [Flow] of [MediaGroupUpdate]. Please, remember that it could be either [EditMediaGroupUpdate]
* or [SentMediaGroupUpdate]
*
* @see onlySentMediaGroupUpdates
* @see onlyEditMediaGroupUpdates
*/
fun Flow.onlyMediaGroupsUpdates(): Flow = filterIsInstance()
/**
* Converts flow to [Flow] of [SentMediaGroupUpdate]
*/
fun Flow.onlySentMediaGroupUpdates(): Flow = filterIsInstance()
/**
* Converts flow to [Flow] of [EditMediaGroupUpdate]
*/
fun Flow.onlyEditMediaGroupUpdates(): Flow = filterIsInstance()