diff options
| author | acdenisSK <[email protected]> | 2017-09-29 16:13:01 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-09-29 16:13:01 +0200 |
| commit | d90b90c7f3d8a368acbab46150f199866562229a (patch) | |
| tree | 42b9a5c2a061ba662fef19277d2711c60b8c6570 /src/framework/standard/mod.rs | |
| parent | Fix User::tag and CurrentUser::tag discrim output (diff) | |
| download | serenity-d90b90c7f3d8a368acbab46150f199866562229a.tar.xz serenity-d90b90c7f3d8a368acbab46150f199866562229a.zip | |
Change the way users' command handlers are stored as
Diffstat (limited to 'src/framework/standard/mod.rs')
| -rw-r--r-- | src/framework/standard/mod.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs index ffee5d2..1f4a33e 100644 --- a/src/framework/standard/mod.rs +++ b/src/framework/standard/mod.rs @@ -596,20 +596,18 @@ impl StandardFramework { /// }); /// # } /// ``` - pub fn on<F, S>(mut self, command_name: S, f: F) -> Self - where F: Fn(&mut Context, &Message, Args) -> Result<(), CommandError> + Send + Sync + 'static, - S: Into<String> { + pub fn on(mut self, name: &str, + f: fn(&mut Context, &Message, Args) + -> Result<(), CommandError>) -> Self { { let ungrouped = self.groups .entry("Ungrouped".to_owned()) .or_insert_with(|| Arc::new(CommandGroup::default())); if let Some(ref mut group) = Arc::get_mut(ungrouped) { - let name = command_name.into(); - group .commands - .insert(name, CommandOrAlias::Command(Arc::new(Command::new(f)))); + .insert(name.to_string(), CommandOrAlias::Command(Arc::new(Command::new(f)))); } } |