# filterCommandsWithArgs - docs

docs / com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates / kotlinx.coroutines.flow.Flow / filterCommandsWithArgs

# filterCommandsWithArgs

(common) `fun <T : BaseSentMessageUpdate> Flow<T>.filterCommandsWithArgs(commandRegex: Regex): Flow<List<TextSource>>` (source)

Convert incoming com.github.insanusmokrassar.TelegramBotAPI.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.

Return
Converted list with first entity BotCommandTextSource and than all others according to rules in description

See Also

fullEntitiesList

asContentMessagesFlow

onlyTextContentMessages