diff options
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 |