From e6712c9459c367cf9ba3e5d9bf1c0831357a20b5 Mon Sep 17 00:00:00 2001 From: Maiddog Date: Fri, 12 May 2017 21:17:21 -0500 Subject: Framework: trim content before parsing args --- src/ext/framework/mod.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/ext/framework') diff --git a/src/ext/framework/mod.rs b/src/ext/framework/mod.rs index e4c57f3..4dd394e 100644 --- a/src/ext/framework/mod.rs +++ b/src/ext/framework/mod.rs @@ -477,13 +477,17 @@ impl Framework { let after = self.after.clone(); let groups = self.groups.clone(); - let args = if command.use_quotes { - utils::parse_quotes(&message.content[position + command_length..]) - } else { - message.content[position + command_length..] - .split_whitespace() - .map(|arg| arg.to_owned()) - .collect::>() + let args = { + let content = message.content[position..].trim(); + + if command.use_quotes { + utils::parse_quotes(&content[command_length..]) + } else { + content[command_length..] + .split_whitespace() + .map(|arg| arg.to_owned()) + .collect::>() + } }; if let Some(error) = self.should_fail(&mut context, &message, &command, args.len(), &to_check, &built) { -- cgit v1.2.3