From ce9201a710107c405959e70309a1956a50cef1c2 Mon Sep 17 00:00:00 2001 From: toast Date: Thu, 7 Dec 2023 12:14:49 +1100 Subject: [PATCH] Format the code a bit neater --- src/commands/data.rs | 8 ++++---- src/commands/eval.rs | 10 ++++++---- src/main.rs | 5 ++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/commands/data.rs b/src/commands/data.rs index 8803063..a3c16ad 100644 --- a/src/commands/data.rs +++ b/src/commands/data.rs @@ -31,9 +31,9 @@ pub async fn data( ctx.send(|m| { m.embed(|e| { e.color(crate::COLOR) - .author(|a| { + .author(|a| a.name(format!("{}/{}", slot_cur, slot_cap)) - }) + ) .title(name) .description("*Nobody is playing*") .fields(vec![ @@ -44,9 +44,9 @@ pub async fn data( ("Autosave", "xx", true), ("Timescale", "0x", true) ]) - .footer(|f| { + .footer(|f| f.text("Last updated") - }) + ) .timestamp(poise::serenity_prelude::Timestamp::now()) }) }).await?; diff --git a/src/commands/eval.rs b/src/commands/eval.rs index 9646519..cfe52ea 100644 --- a/src/commands/eval.rs +++ b/src/commands/eval.rs @@ -1,9 +1,11 @@ use crate::Error; use poise::serenity_prelude::UserId; -use std::os::unix::fs::PermissionsExt; -use std::process::Command; -use std::io::Write; +use std::{ + io::Write, + process::Command, + os::unix::fs::PermissionsExt +}; const WHITELISTED_USERS: &[UserId] = &[ UserId(190407856527376384) @@ -51,6 +53,6 @@ pub async fn eval( return Ok(()); } - ctx.reply(format!("Code output:\n```rs\n{}```", String::from_utf8_lossy(&output.stdout))).await?; + ctx.reply(format!("Output:\n```{}```", String::from_utf8_lossy(&output.stdout))).await?; Ok(()) } diff --git a/src/main.rs b/src/main.rs index eee9081..c986b4c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,11 +57,10 @@ async fn main() { commands::eval::eval(), commands::data::data() ], - pre_command: |ctx| { + pre_command: |ctx| Box::pin(async move { println!("{} ran /{}", ctx.author().name, ctx.command().name) - }) - }, + }), ..Default::default() }).setup(|ctx, ready, framework| Box::pin(on_ready(ctx, ready, framework))) .build().await.expect("Error while building the client");