aboutsummaryrefslogtreecommitdiff
path: root/src/ext/framework/command.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-29 20:51:10 -0800
committerAustin Hellyer <[email protected]>2016-11-29 22:27:59 -0800
commit93b990d8d1bc9df69b8e27a3db61da570822aad6 (patch)
tree6305cf635df90681527a8e736f65ff19f21fd8bc /src/ext/framework/command.rs
parentAdd more shiny readme badges (diff)
downloadserenity-93b990d8d1bc9df69b8e27a3db61da570822aad6.tar.xz
serenity-93b990d8d1bc9df69b8e27a3db61da570822aad6.zip
Clean up the codebase
Diffstat (limited to 'src/ext/framework/command.rs')
-rw-r--r--src/ext/framework/command.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ext/framework/command.rs b/src/ext/framework/command.rs
index e0a4616..46338a1 100644
--- a/src/ext/framework/command.rs
+++ b/src/ext/framework/command.rs
@@ -1,5 +1,5 @@
use std::sync::Arc;
-use super::{CommandType, Configuration};
+use super::Configuration;
use ::client::Context;
use ::model::Message;
@@ -8,15 +8,14 @@ pub type Command = Fn(&Context, &Message, Vec<String>) + Send + Sync;
#[doc(hidden)]
pub type InternalCommand = Arc<Command>;
-pub fn positions(content: &str, conf: &Configuration)
- -> Option<(Vec<usize>, CommandType)> {
+pub fn positions(content: &str, conf: &Configuration) -> Option<Vec<usize>> {
if let Some(ref prefix) = conf.prefix {
// Find out if they were mentioned. If not, determine if the prefix
// was used. If not, return None.
- let (mut positions, kind) = if let Some(mention_end) = find_mention_end(content, conf) {
- (vec![mention_end], CommandType::Mention)
+ let mut positions = if let Some(mention_end) = find_mention_end(content, conf) {
+ vec![mention_end]
} else if content.starts_with(prefix) {
- (vec![prefix.len()], CommandType::Prefix)
+ vec![prefix.len()]
} else {
return None;
};
@@ -29,7 +28,7 @@ pub fn positions(content: &str, conf: &Configuration)
positions.insert(0, pos + 1);
}
- Some((positions, kind))
+ Some(positions)
} else if conf.on_mention.is_some() {
match find_mention_end(content, conf) {
Some(mention_end) => {
@@ -39,7 +38,7 @@ pub fn positions(content: &str, conf: &Configuration)
positions.insert(0, mention_end + 1);
}
- Some((positions, CommandType::Mention))
+ Some(positions)
},
None => None,
}