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

Functions

asCommonMessagesFlow
Link copied to clipboard
fun <T : BaseSentMessageUpdate> Flow<T>.asCommonMessagesFlow(): Flow<CommonMessage<*>>
asContentMessagesFlow
Link copied to clipboard
fun <T : BaseSentMessageUpdate> Flow<T>.asContentMessagesFlow(): Flow<ContentMessage<*>>
asDataCallbackQueryFlow
Link copied to clipboard
common
fun Flow<CallbackQueryUpdate>.asDataCallbackQueryFlow(): Flow<DataCallbackQuery>
asGameShortNameCallbackQueryFlow
Link copied to clipboard
common
asUnknownCallbackQueryFlow
Link copied to clipboard
common
fun Flow<CallbackQueryUpdate>.asUnknownCallbackQueryFlow(): Flow<UnknownCallbackQueryType>
asUnknownMessagesFlow
Link copied to clipboard
fun <T : BaseSentMessageUpdate> Flow<T>.asUnknownMessagesFlow(): Flow<UnknownMessageType>
chatEvents
Link copied to clipboard
common
inline fun <T : BaseSentMessageUpdate> Flow<T>.chatEvents(): Flow<ChatEventMessage<*>>
convertWithMediaGroupUpdates
Link copied to clipboard

Will convert incoming list of updates to list with MediaGroupUpdates

common
fun List<Update>.convertWithMediaGroupUpdates(): List<Update>
filterBaseMessageUpdatesByChat
Link copied to clipboard

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

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

Flow.filter incoming BaseMessageUpdates by their ChatId

common
fun <T : BaseMessageUpdate> Flow<T>.filterBaseMessageUpdatesByChatId(chatId: ChatId): Flow<T>
filterCommandsInsideTextMessages
Link 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

common
fun <T : BaseSentMessageUpdate> Flow<T>.filterCommandsInsideTextMessages(commandRegex: Regex): Flow<ContentMessage<TextContent>>
filterCommandsWithArgs
Link 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.

common
fun <T : BaseSentMessageUpdate> Flow<T>.filterCommandsWithArgs(commandRegex: Regex): Flow<Pair<ContentMessage<TextContent>, List<TextSource>>>
filterExactCommands
Link 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

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

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

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

Flow.filter incoming SentMediaGroupUpdates by their ChatId

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

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

common
inline fun flowsUpdatesFilter(internalChannelsSizes: Int, block: FlowsUpdatesFilter.() -> Unit): FlowsUpdatesFilter
lastUpdateIdentifier
Link copied to clipboard
common
fun Update.lastUpdateIdentifier(): Long
fun List<Update>.lastUpdateIdentifier(): Long?
onlyBaseChosenInlineResults
Link copied to clipboard
common
fun Flow<ChosenInlineResultUpdate>.onlyBaseChosenInlineResults(): Flow<BaseChosenInlineResult>
onlyBaseChosenInlineResultsWithUpdates
Link copied to clipboard
common
onlyBaseInlineQueries
Link copied to clipboard
common
fun Flow<InlineQueryUpdate>.onlyBaseInlineQueries(): Flow<BaseInlineQuery>
onlyBaseInlineQueriesWithUpdates
Link copied to clipboard
common
fun Flow<InlineQueryUpdate>.onlyBaseInlineQueriesWithUpdates(): Flow<Pair<Long, BaseInlineQuery>>
onlyBaseMessageUpdates
Link copied to clipboard
common
fun Flow<Update>.onlyBaseMessageUpdates(): Flow<BaseMessageUpdate>
onlyEditMediaGroupUpdates
Link copied to clipboard

Converts flow to Flow of EditMediaGroupUpdate

common
fun Flow<MediaGroupUpdate>.onlyEditMediaGroupUpdates(): Flow<EditMediaGroupUpdate>
onlyEditMessageUpdates
Link copied to clipboard

Converts flow to Flow of BaseSentMessageUpdate

common
fun Flow<BaseMessageUpdate>.onlyEditMessageUpdates(): Flow<BaseEditMessageUpdate>
onlyLocationChosenInlineResults
Link copied to clipboard
common
onlyLocationInlineQueries
Link copied to clipboard
common
fun Flow<InlineQueryUpdate>.onlyLocationInlineQueries(): Flow<LocationInlineQuery>
onlyLocationInlineQueriesWithUpdates
Link copied to clipboard
common
onlyMediaGroupsUpdates
Link copied to clipboard

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

common
fun Flow<BaseMessageUpdate>.onlyMediaGroupsUpdates(): Flow<MediaGroupUpdate>
onlySentMediaGroupUpdates
Link copied to clipboard

Converts flow to Flow of SentMediaGroupUpdate

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

Converts flow to Flow of BaseSentMessageUpdate

common
fun Flow<BaseMessageUpdate>.onlySentMessageUpdates(): Flow<BaseSentMessageUpdate>
toEditMediaGroupUpdate
Link copied to clipboard
common
toSentMediaGroupUpdate
Link copied to clipboard
common
toTelegramUpdate
Link copied to clipboard
common
fun String.toTelegramUpdate(): Update
fun JsonElement.toTelegramUpdate(): Update
fun Json.toTelegramUpdate(source: String): Update
fun Json.toTelegramUpdate(source: JsonElement): Update