fn quit(ctx: &mut Context, msg: &Message) -> CommandResult {
    msg.reply(&ctx, "Shutting down!")?;

    if let Some(client) = Hub::current().client() {
        client.close(Some(Duration::seconds(2).to_std()?));
    }
    {
        let shard_manager = {
            let data = match ctx.data.try_read() {
                Some(v) => v,
                None => {
                    error!("Couldn't get data lock for a graceful shutdown, killing bot");
                    std::process::exit(0)
                }
            };

            match data.get::<ShardManagerContainer>() {
                Some(v) => std::sync::Arc::clone(v),
                None => {
                    error!(
                        "Couldn't get the shard manager for a graceful shutdown, killing the bot...."
                    );
                    std::process::exit(0)
                }
            }
        };

        if let Some(mut manager) = shard_manager.try_lock() {
            info!("Telling serenity to close all shards, then shutdown");
            manager.shutdown_all();
        } else {
            error!(
                "Couldn't get the shard manager lock for a graceful shutdown, killing the bot..."
            );
            std::process::exit(0)
        };
    }

    Ok(())
}
/// Kills this instance of the bot, only available to bot owners
Kills this instance of the bot, only available to bot owners
Kills this instance of the bot only available to bot owners
fn quit(ctx: &mut Context, msg: &Message) -> CommandResult {
    msg.reply(&ctx, "Shutting down!")?;
    if let Some(client) = Hub::current().client() {
        client.close(Some(Duration::seconds(2).to_std()?));
    }
    {
        let shard_manager = {
            let data = match ctx.data.try_read() {
                Some(v) => v,
                None => {
                    error!("Couldn't get data lock for a graceful shutdown, killing bot");
                    std::process::exit(0)
                }
            };
            match data.get::<ShardManagerContainer>() {
                Some(v) => std::sync::Arc::clone(v),
                None => {
                    error!(
                        "Couldn't get the shard manager for a graceful shutdown, killing the bot...."
                    );
                    std::process::exit(0)
                }
            }
        };
        if let Some(mut manager) = shard_manager.try_lock() {
            info!("Telling serenity to close all shards, then shutdown");
            manager.shutdown_all();
        } else {
            error!(
                "Couldn't get the shard manager lock for a graceful shutdown, killing the bot..."
            );
            std::process::exit(0)
        };
    }
    Ok(())
}
fn quit ( ctx : & mut Context , msg : & Message ) -> CommandResult { msg . reply ( & ctx , " " ) ? ; if let Some ( client ) = Hub :: current ( ) . client ( ) { client . close ( Some ( Duration :: seconds ( 2 ) . to_std ( ) ? ) ) ; } { let shard_manager = { let data = match ctx . data . try_read ( ) { Some ( v ) => v , None => { error ! ( " " ) ; std :: process :: exit ( 0 ) } } ; match data . get :: < ShardManagerContainer > ( ) { Some ( v ) => std :: sync :: Arc :: clone ( v ) , None => { error ! ( " " ) ; std :: process :: exit ( 0 ) } } } ; if let Some ( mut manager ) = shard_manager . try_lock ( ) { info ! ( " " ) ; manager . shutdown_all ( ) ; } else { error ! ( " " ) ; std :: process :: exit ( 0 ) } ; } Ok ( ( ) ) }
Kills this instance of the bot, only available to bot owners
Kills this instance of the bot only available to bot owners
ctx
&mut Context
msg
&Message
ctx
&mut Context
msg
&Message