diff options
| author | Lakelezz <[email protected]> | 2018-07-15 16:49:25 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-07-15 16:49:25 +0200 |
| commit | 305d2008216b5351d9fdd357381027ea42f4740b (patch) | |
| tree | de151f91f3774c60abbdaf6cb30831f77ef8c354 /examples/05_command_framework/src | |
| parent | Add checks for groups (#349) (diff) | |
| download | serenity-305d2008216b5351d9fdd357381027ea42f4740b.tar.xz serenity-305d2008216b5351d9fdd357381027ea42f4740b.zip | |
Support multiple prefixes for command-groups (#343)
Diffstat (limited to 'examples/05_command_framework/src')
| -rw-r--r-- | examples/05_command_framework/src/main.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/05_command_framework/src/main.rs b/examples/05_command_framework/src/main.rs index afec234..ca766db 100644 --- a/examples/05_command_framework/src/main.rs +++ b/examples/05_command_framework/src/main.rs @@ -168,6 +168,7 @@ fn main() { .bucket("complicated") .cmd(commands)) .group("Emoji", |g| g + // Sets a single prefix for a group: .prefix("emoji") .command("cat", |c| c .desc("Sends an emoji with a cat.") @@ -180,9 +181,14 @@ fn main() { .desc("Sends an emoji with a dog.") .bucket("emoji") .cmd(dog))) - .command("multiply", |c| c - .known_as("*") // Lets us call ~* instead of ~multiply - .cmd(multiply)) + .group("Math", |g| g + // Sets multiple prefixes for a group. + // This requires us to call commands in this group + // via `~math` (or `~m`) instead of just `~`. + .prefixes(vec!["m", "math"]) + .command("multiply", |c| c + .known_as("*") // Lets us also call `~math *` instead of just `~math multiply`. + .cmd(multiply))) .command("latency", |c| c .cmd(latency)) .command("ping", |c| c |