1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-15 06:15:27 +00:00
tgbotapi/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/InlineQueryUpdatesConversations.kt

36 lines
1.8 KiB
Kotlin
Raw Normal View History

package dev.inmo.tgbotapi.extensions.utils.updates
2020-09-22 08:47:34 +00:00
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.extensions.utils.internal_utils.onlySpecifiedTypeOfData
import dev.inmo.tgbotapi.extensions.utils.internal_utils.onlySpecifiedTypeOfDataWithUpdates
import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery
import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery
2024-03-16 14:32:18 +00:00
import dev.inmo.tgbotapi.types.UpdateId
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.types.update.InlineQueryUpdate
2020-11-05 18:12:14 +00:00
import kotlinx.coroutines.flow.Flow
2020-09-22 08:47:34 +00:00
/**
2024-03-16 14:32:18 +00:00
* @return Mapped [Flow] with [Pair]s. [Pair.first] in this pair will be [UpdateId]. It could be useful in
2020-09-22 08:47:34 +00:00
* cases you are using [InlineQueryUpdate.updateId] for some reasons. [Pair.second] will always be [BaseInlineQuery].
*/
2024-03-16 14:32:18 +00:00
fun Flow<InlineQueryUpdate>.onlyBaseInlineQueriesWithUpdates(): Flow<Pair<UpdateId, BaseInlineQuery>> = onlySpecifiedTypeOfDataWithUpdates()
2020-09-22 08:47:34 +00:00
/**
* @return Filter updates only with [BaseInlineQuery] and map it to a [Flow] with values [BaseInlineQuery]
*
* @see onlyBaseInlineQueriesWithUpdates
*/
fun Flow<InlineQueryUpdate>.onlyBaseInlineQueries(): Flow<BaseInlineQuery> = onlySpecifiedTypeOfData()
/**
2024-03-16 14:32:18 +00:00
* @return Mapped [Flow] with [Pair]s. [Pair.first] in this pair will be [UpdateId]. It could be useful in
2020-09-22 08:47:34 +00:00
* cases you are using [InlineQueryUpdate.updateId] for some reasons. [Pair.second] will always be [LocationInlineQuery].
*/
2024-03-16 14:32:18 +00:00
fun Flow<InlineQueryUpdate>.onlyLocationInlineQueriesWithUpdates(): Flow<Pair<UpdateId, LocationInlineQuery>> = onlySpecifiedTypeOfDataWithUpdates()
2020-09-22 08:47:34 +00:00
/**
* @return Filter updates only with [LocationInlineQuery] and map it to a [Flow] with values [LocationInlineQuery]
*
* @see onlyLocationInlineQueriesWithUpdates
*/
fun Flow<InlineQueryUpdate>.onlyLocationInlineQueries(): Flow<LocationInlineQuery> = onlySpecifiedTypeOfData()