aboutsummaryrefslogtreecommitdiff
path: root/examples/07_sample_bot_structure/src/commands
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-10-29 11:56:25 -0700
committerZeyla Hellyer <[email protected]>2017-10-29 11:56:25 -0700
commit41f26b3757c7a5fba1f09f34e3192e2fd9702a4a (patch)
treecf2c2e823fad640d99f5ef2f4fc6d6c56d72774f /examples/07_sample_bot_structure/src/commands
parentFix shard shutdown via Context (diff)
downloadserenity-41f26b3757c7a5fba1f09f34e3192e2fd9702a4a.tar.xz
serenity-41f26b3757c7a5fba1f09f34e3192e2fd9702a4a.zip
Add owner + quit functionality to example 07
Diffstat (limited to 'examples/07_sample_bot_structure/src/commands')
-rw-r--r--examples/07_sample_bot_structure/src/commands/mod.rs1
-rw-r--r--examples/07_sample_bot_structure/src/commands/owner.rs10
2 files changed, 11 insertions, 0 deletions
diff --git a/examples/07_sample_bot_structure/src/commands/mod.rs b/examples/07_sample_bot_structure/src/commands/mod.rs
index bf58dba..9c5dfaa 100644
--- a/examples/07_sample_bot_structure/src/commands/mod.rs
+++ b/examples/07_sample_bot_structure/src/commands/mod.rs
@@ -1,2 +1,3 @@
pub mod math;
pub mod meta;
+pub mod owner;
diff --git a/examples/07_sample_bot_structure/src/commands/owner.rs b/examples/07_sample_bot_structure/src/commands/owner.rs
new file mode 100644
index 0000000..e80c19d
--- /dev/null
+++ b/examples/07_sample_bot_structure/src/commands/owner.rs
@@ -0,0 +1,10 @@
+command!(quit(ctx, msg, _args) {
+ match ctx.quit() {
+ Ok(()) => {
+ let _ = msg.reply("Shutting down!");
+ },
+ Err(why) => {
+ let _ = msg.reply(&format!("Failed to shutdown: {:?}", why));
+ },
+ }
+});