You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
591 B
22 lines
591 B
3 years ago
|
use serenity::framework::standard::{macros::command, CommandResult};
|
||
|
use serenity::model::prelude::*;
|
||
|
use serenity::prelude::*;
|
||
|
|
||
|
use crate::ShardManagerContainer;
|
||
|
|
||
|
#[command]
|
||
|
#[owners_only]
|
||
|
async fn sleep(ctx: &Context, msg: &Message) -> CommandResult {
|
||
|
let data = ctx.data.read().await;
|
||
|
|
||
|
if let Some(manager) = data.get::<ShardManagerContainer>() {
|
||
|
msg.reply(ctx, "Good night!").await?;
|
||
|
manager.lock().await.shutdown_all().await;
|
||
|
} else {
|
||
|
msg.reply(ctx, "There was a problem getting the shard manager").await?;
|
||
|
|
||
|
return Ok(());
|
||
|
}
|
||
|
|
||
|
Ok(())
|
||
|
}
|