1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-07-03 06:40:49 +00:00
tgbotapi/docs/dev.inmo.tgbotapi.extensions.utils.shortcuts/filter-commands-with-args.md
2021-03-17 15:18:37 +00:00

4.7 KiB

//docs/dev.inmo.tgbotapi.extensions.utils.shortcuts/filterCommandsWithArgs

filterCommandsWithArgs

[common]
Content
fun <T : ContentMessage<TextContent>> <T>.filterCommandsWithArgs(commandRegex: Regex): <Pair<T, List<TextSource>>>
More info

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.

Return

Paired original message and converted list with first entity BotCommandTextSource and than all others according to rules in description

See also

common

fullEntitiesList
asContentMessagesFlow
onlyTextContentMessages
textMessages