aboutsummaryrefslogtreecommitdiff
path: root/src/ext/framework
diff options
context:
space:
mode:
authorMaiddog <[email protected]>2017-05-12 21:17:21 -0500
committerzeyla <[email protected]>2017-05-12 19:17:21 -0700
commite6712c9459c367cf9ba3e5d9bf1c0831357a20b5 (patch)
treed3af7f483221e5c2f47351d3adebb60aa69be8b1 /src/ext/framework
parentAdd Eq, PartialEq, Hash to ReactionType derives (diff)
downloadserenity-e6712c9459c367cf9ba3e5d9bf1c0831357a20b5.tar.xz
serenity-e6712c9459c367cf9ba3e5d9bf1c0831357a20b5.zip
Framework: trim content before parsing args
Diffstat (limited to 'src/ext/framework')
-rw-r--r--src/ext/framework/mod.rs18
1 files changed, 11 insertions, 7 deletions
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::<Vec<String>>()
+ 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::<Vec<String>>()
+ }
};
if let Some(error) = self.should_fail(&mut context, &message, &command, args.len(), &to_check, &built) {