pub fn parse_command_with_prefix<'a, N>(
prefix: &str,
text: &'a str,
bot_name: N,
) -> Option<(&'a str, Vec<&'a str>)>Expand description
Parses a string into a command with args (custom prefix).
prefix: symbols, which denote start of a command.
ยงExample
use teloxide_ng::utils::command::parse_command_with_prefix;
let text = "!mute 5 hours";
let (command, args) = parse_command_with_prefix("!", text, "").unwrap();
assert_eq!(command, "mute");
assert_eq!(args, vec!["5", "hours"]);If the name of a bot does not match, it will return None:
use teloxide_ng::utils::command::parse_command_with_prefix;
let result = parse_command_with_prefix("!", "!ban@MyNameBot1 3 hours", "MyNameBot2");
assert!(result.is_none());