mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-23 00:57:13 +00:00
add passportMessages extension
This commit is contained in:
parent
6dcdc2ab7f
commit
5a3edc2b44
@ -2,6 +2,7 @@
|
||||
|
||||
package dev.inmo.tgbotapi.extensions.utils.updates
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.PassportMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
@ -26,6 +27,11 @@ inline fun <T : BaseSentMessageUpdate> Flow<T>.chatEvents() = mapNotNull {
|
||||
it.data as? ChatEventMessage<*>
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun <T : BaseSentMessageUpdate> Flow<T>.passportMessages() = mapNotNull {
|
||||
it.data as? PassportMessage
|
||||
}
|
||||
|
||||
/**
|
||||
* Will map incoming [BaseSentMessageUpdate]s to [UnknownMessageType] from [BaseSentMessageUpdate.data]
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user