aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-08-12 20:38:35 +0200
committeracdenisSK <[email protected]>2017-08-12 20:38:35 +0200
commite5889ed1a62ddcb6bc11364800cd813329eb3ece (patch)
treea4d4a5ad054b9f8b4c59b4eb2a456942f3629eab /src/framework
parentRewamp the custom delimeter functionality to support more (diff)
downloadserenity-e5889ed1a62ddcb6bc11364800cd813329eb3ece.tar.xz
serenity-e5889ed1a62ddcb6bc11364800cd813329eb3ece.zip
Trim a second time for a sake
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/mod.rs14
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>>()