From f96b6cc5e1e0383fd2de826c8ffd95565d5ca4fb Mon Sep 17 00:00:00 2001 From: taavi? Date: Thu, 29 Dec 2016 23:21:57 +0300 Subject: Add command alias support and command.example --- examples/06_command_framework/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'examples/06_command_framework/src') 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!")) -- cgit v1.2.3