From d527b7db0a06e02d47e6a6574a6cf222bfcd88df Mon Sep 17 00:00:00 2001 From: Lucy Bladen Date: Mon, 18 Jul 2022 00:49:11 +0100 Subject: [PATCH] Add config dump --- src/core_commands.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core_commands.rs b/src/core_commands.rs index f92f484..5dfa4e1 100644 --- a/src/core_commands.rs +++ b/src/core_commands.rs @@ -93,6 +93,19 @@ async fn set_config(ctx: &Context, msg: &Message, mut args: Args) -> CommandResu Ok(()) } +#[command] +async fn dump_config(ctx: &Context, msg: &Message, _args: Args) -> CommandResult { + let data = &ctx.data.read().await; + let config = match data.get::() { + Some(c) => c.lock().await, + None => Err("Could not lock database!".to_string())? + }; + + msg.reply_ping(&ctx, format!("Config dump; {:?}", &config.config)).await?; + + Ok(()) +} + #[command] async fn get_environment(ctx: &Context, msg: &Message, _: Args) -> CommandResult {