diff options
| author | Lakelezz <[email protected]> | 2018-08-11 18:10:32 +0200 |
|---|---|---|
| committer | zeyla <[email protected]> | 2018-08-11 09:10:32 -0700 |
| commit | 46b419460254edc2343b5a184952ab5c6e53b287 (patch) | |
| tree | c1a0701d8a79dee746526fe881221acab61e55a7 /src/framework | |
| parent | Use one macro instead of the same code twice, avoid seperated changes. (#365) (diff) | |
| download | serenity-46b419460254edc2343b5a184952ab5c6e53b287.tar.xz serenity-46b419460254edc2343b5a184952ab5c6e53b287.zip | |
Make default-command receive every bit of the command upon failure
Diffstat (limited to 'src/framework')
| -rw-r--r-- | src/framework/standard/mod.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs index 4f11e89..86b8c59 100644 --- a/src/framework/standard/mod.rs +++ b/src/framework/standard/mod.rs @@ -1047,12 +1047,13 @@ impl Framework for StandardFramework { } let mut check_contains_group_prefix = false; + let mut longest_matching_prefix_len = 0; let to_check = if let Some(ref prefixes) = group.prefixes { // Once `built` starts with a set prefix, // we want to make sure that all following matching prefixes are longer // than the last matching one, this prevents picking a wrong prefix, // e.g. "f" instead of "ferris" due to "f" having a lower index in the `Vec`. - let longest_matching_prefix_len = prefixes.iter().fold(0, |longest_prefix_len, prefix| + longest_matching_prefix_len = prefixes.iter().fold(0, |longest_prefix_len, prefix| if prefix.len() > longest_prefix_len && built.starts_with(prefix) && (orginal_round.len() == prefix.len() || built.get(prefix.len()..prefix.len() + 1) == Some(" ")) { @@ -1156,9 +1157,7 @@ impl Framework for StandardFramework { if let &Some(CommandOrAlias::Command(ref command)) = &group.default_command { let command = Arc::clone(command); let mut args = { - let content = to_check; - - Args::new(&content.trim(), &self.configuration.delimiters) + Args::new(&orginal_round[longest_matching_prefix_len..], &self.configuration.delimiters) }; threadpool.execute(move || { |