summaryrefslogtreecommitdiff
path: root/src/commands/owner.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/owner.rs')
-rw-r--r--src/commands/owner.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/commands/owner.rs b/src/commands/owner.rs
new file mode 100644
index 0000000..cebb759
--- /dev/null
+++ b/src/commands/owner.rs
@@ -0,0 +1,25 @@
+use crate::ShardManagerContainer;
+use serenity::prelude::*;
+use serenity::model::prelude::*;
+use serenity::framework::standard::{
+ CommandResult,
+ macros::command,
+};
+
+#[command]
+#[owners_only]
+fn quit(ctx: &mut Context, msg: &Message) -> CommandResult {
+ let data = ctx.data.read();
+
+ if let Some(manager) = data.get::<ShardManagerContainer>() {
+ manager.lock().shutdown_all();
+ } else {
+ let _ = msg.reply(&ctx, "There was a problem getting the shard manager");
+
+ return Ok(());
+ }
+
+ let _ = msg.reply(&ctx, "Shutting down!");
+
+ Ok(())
+}