diff options
| author | Lakelezz <[email protected]> | 2018-07-21 01:48:12 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-07-21 01:48:12 +0200 |
| commit | 40c8248d107b3c6cad785502e6d619669aba6431 (patch) | |
| tree | c8553c60b7e9b1367c4d6d51fcbc4e00143cd979 /src/framework/standard/create_group.rs | |
| parent | Do not suggest command if no command is actually related to input. (#350) (diff) | |
| download | serenity-40c8248d107b3c6cad785502e6d619669aba6431.tar.xz serenity-40c8248d107b3c6cad785502e6d619669aba6431.zip | |
Add default-commands for command-groups (#351)
Diffstat (limited to 'src/framework/standard/create_group.rs')
| -rw-r--r-- | src/framework/standard/create_group.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/framework/standard/create_group.rs b/src/framework/standard/create_group.rs index 91eef78..0439f63 100644 --- a/src/framework/standard/create_group.rs +++ b/src/framework/standard/create_group.rs @@ -194,4 +194,16 @@ impl CreateGroup { self } + + /// Adds a command for a group that will be executed if no command-name + /// has been passed. + pub fn default_cmd<C: Command + 'static>(mut self, c: C) -> Self { + let cmd: Arc<Command> = Arc::new(c); + + self.0.default_command = Some(CommandOrAlias::Command(Arc::clone(&cmd))); + + cmd.init(); + + self + } } |