diff options
| author | taavi? <[email protected]> | 2016-12-29 23:21:57 +0300 |
|---|---|---|
| committer | zeyla <[email protected]> | 2016-12-29 12:21:57 -0800 |
| commit | f96b6cc5e1e0383fd2de826c8ffd95565d5ca4fb (patch) | |
| tree | e49ca34f9a6ce8bda865bed82c8bd2519c4cbcc4 /examples/06_command_framework/src | |
| parent | Remove use of struct pattern match (diff) | |
| download | serenity-f96b6cc5e1e0383fd2de826c8ffd95565d5ca4fb.tar.xz serenity-f96b6cc5e1e0383fd2de826c8ffd95565d5ca4fb.zip | |
Add command alias support and command.example
Diffstat (limited to 'examples/06_command_framework/src')
| -rw-r--r-- | examples/06_command_framework/src/main.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/06_command_framework/src/main.rs b/examples/06_command_framework/src/main.rs index c9191a8..524f35e 100644 --- a/examples/06_command_framework/src/main.rs +++ b/examples/06_command_framework/src/main.rs @@ -93,7 +93,7 @@ fn main() { }) // Can't be used more than once per 5 seconds: .simple_bucket("emoji", 5) - // Can't be used more than 2 times per 30 seconds, with a 5 second delay + // Can't be used more than 2 times per 30 seconds, with a 5 second delay: .bucket("complicated", 5, 30, 2) .command("about", |c| c.exec_str("A test bot")) .command("help", |c| c.exec_help(help_commands::plain)) @@ -105,6 +105,7 @@ fn main() { .prefix("emoji") .command("cat", |c| c .desc("Sends an emoji with a cat.") + .batch_known_as(vec!["kitty", "neko"]) // Adds multiple aliases .bucket("emoji") // Make this command use the "emoji" bucket. .exec_str(":cat:") // Allow only administrators to call this: @@ -113,7 +114,9 @@ fn main() { .desc("Sends an emoji with a dog.") .bucket("emoji") .exec_str(":dog:"))) - .command("multiply", |c| c.exec(multiply)) + .command("multiply", |c| c + .known_as("*") // Lets us call ~* instead of ~multiply + .exec(multiply)) .command("ping", |c| c .check(owner_check) .exec_str("Pong!")) |