package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST import com.github.insanusmokrassar.TelegramBotAPI.types.update.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UnknownUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.flow.* @Suppress("EXPERIMENTAL_API_USAGE", "unused") class FlowsUpdatesFilter( broadcastChannelsSize: Int = 100 ): UpdatesFilter { private val updatesReceivingChannel = BroadcastChannel(broadcastChannelsSize) @Suppress("MemberVisibilityCanBePrivate") val allUpdatesFlow: Flow = updatesReceivingChannel.asFlow() override val allowedUpdates: List get() = ALL_UPDATES_LIST override val asUpdateReceiver: UpdateReceiver = { updatesReceivingChannel.send(it) } val messageFlow: Flow = allUpdatesFlow.filterIsInstance() val messageMediaGroupFlow: Flow = allUpdatesFlow.filterIsInstance() val editedMessageFlow: Flow = allUpdatesFlow.filterIsInstance() val editedMessageMediaGroupFlow: Flow = allUpdatesFlow.filterIsInstance() val channelPostFlow: Flow = allUpdatesFlow.filterIsInstance() val channelPostMediaGroupFlow: Flow = allUpdatesFlow.filterIsInstance() val editedChannelPostFlow: Flow = allUpdatesFlow.filterIsInstance() val editedChannelPostMediaGroupFlow: Flow = allUpdatesFlow.filterIsInstance() val chosenInlineResultFlow: Flow = allUpdatesFlow.filterIsInstance() val inlineQueryFlow: Flow = allUpdatesFlow.filterIsInstance() val callbackQueryFlow: Flow = allUpdatesFlow.filterIsInstance() val shippingQueryFlow: Flow = allUpdatesFlow.filterIsInstance() val preCheckoutQueryFlow: Flow = allUpdatesFlow.filterIsInstance() val pollFlow: Flow = allUpdatesFlow.filterIsInstance() val pollAnswerFlow: Flow = allUpdatesFlow.filterIsInstance() val unknownUpdateTypeFlow: Flow = allUpdatesFlow.filterIsInstance() }