# filterCommandsInsideTextMessages - docs

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

# filterCommandsInsideTextMessages

(common) `fun <T : BaseSentMessageUpdate> Flow<T>.filterCommandsInsideTextMessages(commandRegex: Regex): Flow<ContentMessage<TextContent>>` (source)

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

Return
The same message in case if it contains somewhere in text BotCommandTextSource with Regex.matches

See Also

fullEntitiesList

asContentMessagesFlow

onlyTextContentMessages