# dev.inmo.tgbotapi.extensions.utils.updates

docs

# Package dev.inmo.tgbotapi.extensions.utils.updates

## Functions

asCommonMessagesFlow
Link copied to clipboard
fun < T : BaseSentMessageUpdate > Flow< T >. asCommonMessagesFlow (): Flow< CommonMessage <*>>
Content copied to clipboard

Will map incoming BaseSentMessageUpdates to CommonMessage from BaseSentMessageUpdate.data

asContentMessagesFlow
Link copied to clipboard
fun < T : BaseSentMessageUpdate > Flow< T >. asContentMessagesFlow (): Flow< ContentMessage <*>>
Content copied to clipboard

Will map incoming BaseSentMessageUpdates to ContentMessage from BaseSentMessageUpdate.data

asDataCallbackQueryFlow
Link copied to clipboard
fun Flow< CallbackQueryUpdate >. asDataCallbackQueryFlow (): Flow< DataCallbackQuery >
Content copied to clipboard
asGameShortNameCallbackQueryFlow
Link copied to clipboard
fun Flow< CallbackQueryUpdate >. asGameShortNameCallbackQueryFlow (): Flow< GameShortNameCallbackQuery >
Content copied to clipboard
asUnknownCallbackQueryFlow
Link copied to clipboard
fun Flow< CallbackQueryUpdate >. asUnknownCallbackQueryFlow (): Flow< UnknownCallbackQueryType >
Content copied to clipboard
asUnknownMessagesFlow
Link copied to clipboard
fun < T : BaseSentMessageUpdate > Flow< T >. asUnknownMessagesFlow (): Flow< UnknownMessageType >
Content copied to clipboard

Will map incoming BaseSentMessageUpdates to UnknownMessageType from BaseSentMessageUpdate.data

chatEvents
Link copied to clipboard
inline fun < T : BaseSentMessageUpdate > Flow< T >. chatEvents (): Flow< ChatEventMessage <*>>
Content copied to clipboard
convertWithMediaGroupUpdates
Link copied to clipboard
fun List < Update >. convertWithMediaGroupUpdates (): List < Update >
Content copied to clipboard

Will convert incoming list of updates to list with MediaGroupUpdates

filterBaseMessageUpdatesByChat
Link copied to clipboard
fun < T : BaseMessageUpdate > Flow< T >. filterBaseMessageUpdatesByChat (chat: Chat ): Flow< T >
Content copied to clipboard

Flow.filter incoming BaseMessageUpdates by their ChatId using Chat.id of chat

filterBaseMessageUpdatesByChatId
Link copied to clipboard
fun < T : BaseMessageUpdate > Flow< T >. filterBaseMessageUpdatesByChatId (chatId: ChatId ): Flow< T >
Content copied to clipboard

Flow.filter incoming BaseMessageUpdates by their ChatId

filterCommandsInsideTextMessages
Link copied to clipboard
fun < T : BaseSentMessageUpdate > Flow< T >. filterCommandsInsideTextMessages (commandRegex: Regex ): Flow< ContentMessage < TextContent >>
Content copied to clipboard

Convert incoming dev.inmo.tgbotapi.types.message.abstracts.ContentMessage.content of messages with fullEntitiesList and check that incoming message contains BotCommandTextSource. Besides, it is checking that BotCommandTextSource.command with incoming commandRegex

filterCommandsWithArgs
Link copied to clipboard
fun < T : BaseSentMessageUpdate > Flow< T >. filterCommandsWithArgs (commandRegex: Regex ): Flow< Pair < ContentMessage < TextContent >, TextSourcesList >>
Content copied to clipboard

Convert incoming dev.inmo.tgbotapi.types.message.abstracts.ContentMessage.content of messages with fullEntitiesList and check that incoming message contains first TextSource as BotCommandTextSource. Besides, it is checking that BotCommandTextSource.command with incoming commandRegex and for other TextSource objects used next rules: all incoming text sources will be passed as is, RegularTextSource will be split by " " for several RegularTextSource which will contains not empty args without spaces.

filterExactCommands
Link copied to clipboard
fun < T : BaseSentMessageUpdate > Flow< T >. filterExactCommands (commandRegex: Regex ): Flow< ContentMessage < TextContent >>
Content copied to clipboard

Convert incoming dev.inmo.tgbotapi.types.message.abstracts.ContentMessage.content of messages with fullEntitiesList and check that incoming message contains ONLY ONE TextSource and that is BotCommandTextSource. Besides, it is checking that BotCommandTextSource.command with incoming commandRegex

filterSentMediaGroupUpdatesByChat
Link copied to clipboard
fun < T : SentMediaGroupUpdate > Flow< T >. filterSentMediaGroupUpdatesByChat (chat: Chat ): Flow< T >
Content copied to clipboard

Flow.filter incoming SentMediaGroupUpdates by their ChatId using Chat.id of chat

filterSentMediaGroupUpdatesByChatId
Link copied to clipboard
fun < T : SentMediaGroupUpdate > Flow< T >. filterSentMediaGroupUpdatesByChatId (chatId: ChatId ): Flow< T >
Content copied to clipboard

Flow.filter incoming SentMediaGroupUpdates by their ChatId

flowsUpdatesFilter
Link copied to clipboard
inline fun flowsUpdatesFilter (internalChannelsSizes: Int = 100, block: FlowsUpdatesFilter .() -> Unit ): FlowsUpdatesFilter
Content copied to clipboard

Non-suspendable function for easy-to-use creating of FlowsUpdatesFilter and applying the block to it

lastUpdateIdentifier
Link copied to clipboard
fun Update . lastUpdateIdentifier (): UpdateIdentifier
Content copied to clipboard
fun List < Update >. lastUpdateIdentifier (): UpdateIdentifier ?
Content copied to clipboard
onlyBaseChosenInlineResults
Link copied to clipboard
fun Flow< ChosenInlineResultUpdate >. onlyBaseChosenInlineResults (): Flow< BaseChosenInlineResult >
Content copied to clipboard
onlyBaseChosenInlineResultsWithUpdates
Link copied to clipboard
fun Flow< ChosenInlineResultUpdate >. onlyBaseChosenInlineResultsWithUpdates (): Flow< Pair < UpdateIdentifier , BaseChosenInlineResult >>
Content copied to clipboard
onlyBaseInlineQueries
Link copied to clipboard
fun Flow< InlineQueryUpdate >. onlyBaseInlineQueries (): Flow< BaseInlineQuery >
Content copied to clipboard
onlyBaseInlineQueriesWithUpdates
Link copied to clipboard
fun Flow< InlineQueryUpdate >. onlyBaseInlineQueriesWithUpdates (): Flow< Pair < UpdateIdentifier , BaseInlineQuery >>
Content copied to clipboard
onlyBaseMessageUpdates
Link copied to clipboard
fun Flow< Update >. onlyBaseMessageUpdates (): Flow< BaseMessageUpdate >
Content copied to clipboard
onlyEditMediaGroupUpdates
Link copied to clipboard
fun Flow< MediaGroupUpdate >. onlyEditMediaGroupUpdates (): Flow< EditMediaGroupUpdate >
Content copied to clipboard

Converts flow to Flow of EditMediaGroupUpdate

onlyEditMessageUpdates
Link copied to clipboard
fun Flow< BaseMessageUpdate >. onlyEditMessageUpdates (): Flow< BaseEditMessageUpdate >
Content copied to clipboard

Converts flow to Flow of BaseSentMessageUpdate

onlyLocationChosenInlineResults
Link copied to clipboard
fun Flow< ChosenInlineResultUpdate >. onlyLocationChosenInlineResults (): Flow< LocationChosenInlineResult >
Content copied to clipboard
onlyLocationChosenInlineResultsWithUpdates
Link copied to clipboard
fun Flow< ChosenInlineResultUpdate >. onlyLocationChosenInlineResultsWithUpdates (): Flow< Pair < UpdateIdentifier , LocationChosenInlineResult >>
Content copied to clipboard
onlyLocationInlineQueries
Link copied to clipboard
fun Flow< InlineQueryUpdate >. onlyLocationInlineQueries (): Flow< LocationInlineQuery >
Content copied to clipboard
onlyLocationInlineQueriesWithUpdates
Link copied to clipboard
fun Flow< InlineQueryUpdate >. onlyLocationInlineQueriesWithUpdates (): Flow< Pair < UpdateIdentifier , LocationInlineQuery >>
Content copied to clipboard
onlyMediaGroupsUpdates
Link copied to clipboard
fun Flow< BaseMessageUpdate >. onlyMediaGroupsUpdates (): Flow< MediaGroupUpdate >
Content copied to clipboard

Converts flow to Flow of MediaGroupUpdate. Please, remember that it could be either EditMediaGroupUpdate or SentMediaGroupUpdate

onlySentMediaGroupUpdates
Link copied to clipboard
fun Flow< MediaGroupUpdate >. onlySentMediaGroupUpdates (): Flow< SentMediaGroupUpdate >
Content copied to clipboard

Converts flow to Flow of SentMediaGroupUpdate

onlySentMessageUpdates
Link copied to clipboard
fun Flow< BaseMessageUpdate >. onlySentMessageUpdates (): Flow< BaseSentMessageUpdate >
Content copied to clipboard

Converts flow to Flow of BaseSentMessageUpdate

passportMessages
Link copied to clipboard
inline fun < T : BaseSentMessageUpdate > Flow< T >. passportMessages (): Flow< PassportMessage >
Content copied to clipboard
toEditMediaGroupUpdate
Link copied to clipboard
fun BaseEditMessageUpdate . toEditMediaGroupUpdate (): EditMediaGroupUpdate
Content copied to clipboard
toSentMediaGroupUpdate
Link copied to clipboard
fun List < BaseSentMessageUpdate >. toSentMediaGroupUpdate (): SentMediaGroupUpdate ?
Content copied to clipboard
toTelegramUpdate
Link copied to clipboard
fun String . toTelegramUpdate (): Update
Content copied to clipboard
fun JsonElement. toTelegramUpdate (): Update
Content copied to clipboard
fun Json. toTelegramUpdate (source: String ): Update
Content copied to clipboard
fun Json. toTelegramUpdate (source: JsonElement): Update
Content copied to clipboard