From 305d2008216b5351d9fdd357381027ea42f4740b Mon Sep 17 00:00:00 2001 From: Lakelezz <12222135+Lakelezz@users.noreply.github.com> Date: Sun, 15 Jul 2018 16:49:25 +0200 Subject: Support multiple prefixes for command-groups (#343) --- examples/05_command_framework/src/main.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'examples/05_command_framework/src') 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 -- cgit v1.2.3