diff options
| author | acdenisSK <[email protected]> | 2017-11-21 16:07:53 +0100 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-11-21 16:07:53 +0100 |
| commit | f61816ca141add5024e36e073764b7c824872ca4 (patch) | |
| tree | 357317f5574698bb67c8a73f633443a50ed20d14 /src/framework/standard/create_group.rs | |
| parent | Remove client close handle (diff) | |
| download | serenity-f61816ca141add5024e36e073764b7c824872ca4.tar.xz serenity-f61816ca141add5024e36e073764b7c824872ca4.zip | |
Add a way to execute code when a command is registered
Diffstat (limited to 'src/framework/standard/create_group.rs')
| -rw-r--r-- | src/framework/standard/create_group.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/framework/standard/create_group.rs b/src/framework/standard/create_group.rs index abdfdc8..25279ca 100644 --- a/src/framework/standard/create_group.rs +++ b/src/framework/standard/create_group.rs @@ -79,11 +79,13 @@ impl CreateGroup { /// /// [`on`]: #method.on pub fn cmd<C: Command + 'static>(mut self, name: &str, c: C) -> Self { - let cmd = Arc::new(c); + let cmd: Arc<Command> = Arc::new(c); self.0 .commands - .insert(name.to_string(), CommandOrAlias::Command(cmd)); + .insert(name.to_string(), CommandOrAlias::Command(Arc::clone(&cmd))); + + cmd.init(); self } |