tgbotapi/TelegramBotAPI-extensions-u.../src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/CallbackQueryConversations.kt

13 lines
447 B
Kotlin

package dev.inmo.tgbotapi.extensions.utils
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.mapNotNull
fun <T : CallbackQuery> Flow<T>.onlyMessageDataCallbackQueries() = mapNotNull {
it as? MessageDataCallbackQuery
}
fun <T : CallbackQuery> Flow<T>.onlyInlineMessageIdDataCallbackQueries() = mapNotNull {
it as? InlineMessageIdDataCallbackQuery
}