diff --git a/src/framework/standard/args.rs b/src/framework/standard/args.rs index d03076f88d5..8f166b60c54 100644 --- a/src/framework/standard/args.rs +++ b/src/framework/standard/args.rs @@ -18,7 +18,7 @@ impl From for Error { fn from(e: E) -> Self { Error::Parse(e) } -} +} impl StdError for Error { fn description(&self) -> &str { @@ -60,7 +60,12 @@ pub struct Args { } impl Args { - pub fn new(message: &str, delimiter: &str) -> Self { + pub fn new(message: &str, possible_delimiters: Vec) -> Self { + let delimiter = possible_delimiters + .iter() + .find(|&d| message.contains(d)) + .map_or(possible_delimiters[0].as_str(), |s| s.as_str()); + let split = if message.trim().is_empty() { Vec::new() } else { diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs index dc065f00e73..e1ec1bdf53a 100644 --- a/src/framework/standard/mod.rs +++ b/src/framework/standard/mod.rs @@ -901,13 +901,7 @@ impl Framework for StandardFramework { let mut content = message.content[position..].trim(); content = content[command_length..].trim(); - let delimiter = self.configuration - .delimiters - .iter() - .find(|&d| content.contains(d)) - .map_or(" ", |s| s.as_str()); - - Args::new(&content, delimiter) + Args::new(&content, self.configuration.delimiters.clone()) }; if let Some(error) = self.should_fail(