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

Functions

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

Will map incoming BaseSentMessageUpdates to CommonMessage from BaseSentMessageUpdate.data

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

Will map incoming BaseSentMessageUpdates to ContentMessage from BaseSentMessageUpdate.data

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

Will map incoming BaseSentMessageUpdates to UnknownMessageType from BaseSentMessageUpdate.data

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

Will convert incoming list of updates to list with MediaGroupUpdates

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

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

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

Flow.filter incoming BaseMessageUpdates by their ChatId

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

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

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

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.

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

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

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

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

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

Flow.filter incoming SentMediaGroupUpdates by their ChatId

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

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

Link copied to clipboard
fun Update.lastUpdateIdentifier(): UpdateIdentifier
fun List<Update>.lastUpdateIdentifier(): UpdateIdentifier?
Link copied to clipboard
Link copied to clipboard
fun Flow<InlineQueryUpdate>.onlyBaseInlineQueries(): Flow<BaseInlineQuery>
Link copied to clipboard
Link copied to clipboard
fun Flow<Update>.onlyBaseMessageUpdates(): Flow<BaseMessageUpdate>
Link copied to clipboard
fun Flow<MediaGroupUpdate>.onlyEditMediaGroupUpdates(): Flow<EditMediaGroupUpdate>

Converts flow to Flow of EditMediaGroupUpdate

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

Converts flow to Flow of BaseSentMessageUpdate

Link copied to clipboard
Link copied to clipboard
fun Flow<InlineQueryUpdate>.onlyLocationInlineQueries(): Flow<LocationInlineQuery>
Link copied to clipboard
Link copied to clipboard
fun Flow<BaseMessageUpdate>.onlyMediaGroupsUpdates(): Flow<MediaGroupUpdate>

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

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

Converts flow to Flow of SentMediaGroupUpdate

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

Converts flow to Flow of BaseSentMessageUpdate

Link copied to clipboard
inline fun <T : BaseSentMessageUpdate> Flow<T>.passportMessages(): Flow<PassportMessage>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun String.toTelegramUpdate(): Update
fun JsonElement.toTelegramUpdate(): Update
fun Json.toTelegramUpdate(source: String): Update
fun Json.toTelegramUpdate(source: JsonElement): Update