diff options
| author | acdenisSK <[email protected]> | 2017-08-12 20:38:35 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-08-12 20:38:35 +0200 |
| commit | e5889ed1a62ddcb6bc11364800cd813329eb3ece (patch) | |
| tree | a4d4a5ad054b9f8b4c59b4eb2a456942f3629eab /src | |
| parent | Rewamp the custom delimeter functionality to support more (diff) | |
| download | serenity-e5889ed1a62ddcb6bc11364800cd813329eb3ece.tar.xz serenity-e5889ed1a62ddcb6bc11364800cd813329eb3ece.zip | |
Trim a second time for a sake
Diffstat (limited to 'src')
| -rw-r--r-- | src/framework/mod.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/framework/mod.rs b/src/framework/mod.rs index d55c26d..ba80e60 100644 --- a/src/framework/mod.rs +++ b/src/framework/mod.rs @@ -931,17 +931,19 @@ impl ::Framework for BuiltinFramework { let groups = self.groups.clone(); let args = { - let content = message.content[position..].trim(); + let mut content = message.content[position..].trim(); + content = content[command_length..].trim(); if command.use_quotes { utils::parse_quotes(&content[command_length..]) } else { - let delimeter = { - let delimeter = self.configuration.delimeters.iter().find(|d| content[command_length..].contains(d.as_str())); - delimeter.map(|s| s.as_str()).unwrap_or(" ") - }; + let delimeter = self.configuration.delimeters + .iter() + .find(|d| content.contains(d.as_str())) + .map(|s| s.as_str()) + .unwrap_or(" "); - content[command_length..] + content .split(delimeter) .map(|arg| arg.to_owned()) .collect::<Vec<String>>() |