diff options
| author | acdenisSK <[email protected]> | 2017-11-20 14:55:32 +0100 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-11-20 14:55:32 +0100 |
| commit | 0aa55a2b9b757321d5b8bb9e512813aa9d0a62ca (patch) | |
| tree | a9e9243c873eadc2ae4a8c7a4733830814bf2c08 /src/framework/standard/create_group.rs | |
| parent | Add guild invite to readme (diff) | |
| download | serenity-0aa55a2b9b757321d5b8bb9e512813aa9d0a62ca.tar.xz serenity-0aa55a2b9b757321d5b8bb9e512813aa9d0a62ca.zip | |
Add an impl for `Fn(&mut Context, &Message, Args)`
Diffstat (limited to 'src/framework/standard/create_group.rs')
| -rw-r--r-- | src/framework/standard/create_group.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/framework/standard/create_group.rs b/src/framework/standard/create_group.rs index 7d7cc36..4aadffc 100644 --- a/src/framework/standard/create_group.rs +++ b/src/framework/standard/create_group.rs @@ -1,6 +1,5 @@ pub use super::command::{Command, CommandGroup, CommandOptions, Error as CommandError}; pub(crate) use super::command::CommandOrAlias; -pub(crate) use super::command::A; pub use super::create_command::{CreateCommand, FnOrCommand}; pub use super::Args; @@ -68,21 +67,17 @@ impl CreateGroup { self } - /// Adds a command to group with simplified API. + /// Adds a command to group with a simplified API. /// You can return Err(From::from(string)) if there's an error. pub fn on(self, name: &str, f: fn(&mut Context, &Message, Args) -> Result<(), CommandError>) -> Self { - self._cmd(name, A(f)) + self.cmd(name, f) } /// Like [`on`], but accepts a `Command` directly. /// /// [`on`]: #method.on - pub fn cmd<C: Command + 'static>(self, name: &str, c: C) -> Self { - self._cmd(name, c) - } - - fn _cmd<C: Command + 'static>(mut self, name: &str, c: C) -> Self { + pub fn cmd<C: Command + 'static>(mut self, name: &str, c: C) -> Self { let cmd = Arc::new(c); self.0 @@ -90,7 +85,7 @@ impl CreateGroup { .insert(name.to_string(), CommandOrAlias::Command(cmd)); self - } + } /// If prefix is set, it will be required before all command names. /// For example, if bot prefix is "~" and group prefix is "image" |