aboutsummaryrefslogtreecommitdiff
path: root/src/ext/framework/command.rs
diff options
context:
space:
mode:
authorTaavi <[email protected]>2017-01-02 03:38:36 +0300
committerzeyla <[email protected]>2017-01-01 16:38:36 -0800
commit18cc152769a35cd1705f045b9815cc90446034ef (patch)
treeb33d18158b62ad5d89cd35f4f547aadb509369e2 /src/ext/framework/command.rs
parentFix command macro signatures (diff)
downloadserenity-18cc152769a35cd1705f045b9815cc90446034ef.tar.xz
serenity-18cc152769a35cd1705f045b9815cc90446034ef.zip
Implement context message queueing
Also the dreaded `ctx <<= "something"` which is actually a mistake.
Diffstat (limited to 'src/ext/framework/command.rs')
-rw-r--r--src/ext/framework/command.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ext/framework/command.rs b/src/ext/framework/command.rs
index 92e6e93..70ee4ff 100644
--- a/src/ext/framework/command.rs
+++ b/src/ext/framework/command.rs
@@ -5,14 +5,14 @@ use ::model::Message;
use ::model::Permissions;
use std::collections::HashMap;
-pub type Check = Fn(&Context, &Message) -> bool + Send + Sync + 'static;
-pub type Exec = Fn(&Context, &Message, Vec<String>) -> Result<(), String> + Send + Sync + 'static;
-pub type Help = Fn(&Context, &Message, HashMap<String, Arc<CommandGroup>>, Vec<String>) -> Result<(), String> + Send + Sync + 'static;
-pub type BeforeHook = Fn(&Context, &Message, &String) -> bool + Send + Sync + 'static;
-pub type AfterHook = Fn(&Context, &Message, &String, Result<(), String>) + Send + Sync + 'static;
+pub type Check = Fn(&mut Context, &Message) -> bool + Send + Sync + 'static;
+pub type Exec = Fn(&mut Context, &Message, Vec<String>) -> Result<(), String> + Send + Sync + 'static;
+pub type Help = Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, Vec<String>) -> Result<(), String> + Send + Sync + 'static;
+pub type BeforeHook = Fn(&mut Context, &Message, &String) -> bool + Send + Sync + 'static;
+pub type AfterHook = Fn(&mut Context, &Message, &String, Result<(), String>) + Send + Sync + 'static;
#[doc(hidden)]
pub type InternalCommand = Arc<Command>;
-pub type PrefixCheck = Fn(&Context) -> Option<String> + Send + Sync + 'static;
+pub type PrefixCheck = Fn(&mut Context) -> Option<String> + Send + Sync + 'static;
#[doc(hidden)]
pub enum CommandOrAlias {
@@ -71,7 +71,7 @@ pub struct Command {
impl Command {
pub fn new<F>(f: F) -> Self
- where F: Fn(&Context, &Message, Vec<String>) -> Result<(), String> + Send + Sync + 'static {
+ where F: Fn(&mut Context, &Message, Vec<String>) -> Result<(), String> + Send + Sync + 'static {
Command {
aliases: Vec::new(),
checks: Vec::default(),
@@ -92,7 +92,7 @@ impl Command {
}
}
-pub fn positions(ctx: &Context, content: &str, conf: &Configuration) -> Option<Vec<usize>> {
+pub fn positions(ctx: &mut Context, content: &str, conf: &Configuration) -> Option<Vec<usize>> {
if !conf.prefixes.is_empty() || conf.dynamic_prefix.is_some() {
// Find out if they were mentioned. If not, determine if the prefix
// was used. If not, return None.