diff options
| author | Taavi <[email protected]> | 2017-01-02 03:38:36 +0300 |
|---|---|---|
| committer | zeyla <[email protected]> | 2017-01-01 16:38:36 -0800 |
| commit | 18cc152769a35cd1705f045b9815cc90446034ef (patch) | |
| tree | b33d18158b62ad5d89cd35f4f547aadb509369e2 /src/ext/framework/create_command.rs | |
| parent | Fix command macro signatures (diff) | |
| download | serenity-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/create_command.rs')
| -rw-r--r-- | src/ext/framework/create_command.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ext/framework/create_command.rs b/src/ext/framework/create_command.rs index c758f4a..4d1e1a5 100644 --- a/src/ext/framework/create_command.rs +++ b/src/ext/framework/create_command.rs @@ -54,19 +54,19 @@ impl CreateCommand { /// .desc("Replies to a ping with a pong") /// .exec(ping))); /// - /// fn ping(context: &Context, _message: &Message, _args: Vec<String>) -> Result<(), String> { + /// fn ping(context: &mut Context, _message: &Message, _args: Vec<String>) -> Result<(), String> { /// let _ = context.say("Pong!"); /// /// Ok(()) /// } /// - /// fn owner_check(_context: &Context, message: &Message) -> bool { + /// fn owner_check(_context: &mut Context, message: &Message) -> bool { /// // replace with your user ID /// message.author.id == 7 /// } /// ``` pub fn check<F>(mut self, check: F) -> Self - where F: Fn(&Context, &Message) -> bool + Send + Sync + 'static { + where F: Fn(&mut Context, &Message) -> bool + Send + Sync + 'static { self.0.checks.push(Box::new(check)); self @@ -100,7 +100,7 @@ impl CreateCommand { /// /// [`exec_str`]: #method.exec_str pub fn exec<F>(mut self, func: 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 { self.0.exec = CommandType::Basic(Box::new(func)); self @@ -112,7 +112,7 @@ impl CreateCommand { /// /// You can return Err(string) if there's an error. pub fn exec_help<F>(mut self, f: F) -> Self - where F: Fn(&Context, &Message, HashMap<String, Arc<CommandGroup>>, Vec<String>) -> Result<(), String> + Send + Sync + 'static { + where F: Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, Vec<String>) -> Result<(), String> + Send + Sync + 'static { self.0.exec = CommandType::WithCommands(Box::new(f)); self |