aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-07 13:52:50 -0800
committerAustin Hellyer <[email protected]>2016-11-07 13:52:50 -0800
commitbcdd4f125d029c6d4c8a3ca79ba3ebecdb9515ab (patch)
tree77e6edee15c415ec176f507ba44a3a00068c17e1 /examples
parentRe-order MessageType definition (diff)
downloadserenity-bcdd4f125d029c6d4c8a3ca79ba3ebecdb9515ab.tar.xz
serenity-bcdd4f125d029c6d4c8a3ca79ba3ebecdb9515ab.zip
Add arguments to framework commands
Diffstat (limited to 'examples')
-rw-r--r--examples/06_command_framework.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/06_command_framework.rs b/examples/06_command_framework.rs
index 1bd3ffd..cb838fd 100644
--- a/examples/06_command_framework.rs
+++ b/examples/06_command_framework.rs
@@ -36,20 +36,20 @@ fn main() {
.on("emoji dog", dog_command)
.on("some complex command", some_complex_command)
// Commands can be in closure-form as well
- .on("about", |context, _message| drop(context.say("A test bot"))));
+ .on("about", |context, _message, _args| drop(context.say("A test bot"))));
let _ = client.start();
}
-fn cat_command(context: Context, _message: Message) {
+fn cat_command(context: Context, _msg: Message, _args: Vec<String>) {
let _ = context.say(":cat:");
}
-fn dog_command(context: Context, _message: Message) {
+fn dog_command(context: Context, _msg: Message, _args: Vec<String>) {
let _ = context.say(":dog:");
}
-fn ping_command(_context: Context, message: Message) {
+fn ping_command(_context: Context, message: Message, _args: Vec<String>) {
let _ = message.reply("Pong!");
}
@@ -58,6 +58,6 @@ fn owner_check(_context: &Context, message: &Message) -> bool {
message.author.id.0 == 7u64
}
-fn some_complex_command(context: Context, _message: Message) {
- let _ = context.say("This is a command in a complex group");
+fn some_complex_command(context: Context, _msg: Message, args: Vec<String>) {
+ let _ = context.say(&format!("Arguments: {:?}", args));
}