Format the code a bit neater

This commit is contained in:
toast 2023-12-07 12:14:49 +11:00
parent 0b70affb92
commit ce9201a710
3 changed files with 12 additions and 11 deletions

View File

@ -31,9 +31,9 @@ pub async fn data(
ctx.send(|m| { ctx.send(|m| {
m.embed(|e| { m.embed(|e| {
e.color(crate::COLOR) e.color(crate::COLOR)
.author(|a| { .author(|a|
a.name(format!("{}/{}", slot_cur, slot_cap)) a.name(format!("{}/{}", slot_cur, slot_cap))
}) )
.title(name) .title(name)
.description("*Nobody is playing*") .description("*Nobody is playing*")
.fields(vec![ .fields(vec![
@ -44,9 +44,9 @@ pub async fn data(
("Autosave", "xx", true), ("Autosave", "xx", true),
("Timescale", "0x", true) ("Timescale", "0x", true)
]) ])
.footer(|f| { .footer(|f|
f.text("Last updated") f.text("Last updated")
}) )
.timestamp(poise::serenity_prelude::Timestamp::now()) .timestamp(poise::serenity_prelude::Timestamp::now())
}) })
}).await?; }).await?;

View File

@ -1,9 +1,11 @@
use crate::Error; use crate::Error;
use poise::serenity_prelude::UserId; use poise::serenity_prelude::UserId;
use std::os::unix::fs::PermissionsExt; use std::{
use std::process::Command; io::Write,
use std::io::Write; process::Command,
os::unix::fs::PermissionsExt
};
const WHITELISTED_USERS: &[UserId] = &[ const WHITELISTED_USERS: &[UserId] = &[
UserId(190407856527376384) UserId(190407856527376384)
@ -51,6 +53,6 @@ pub async fn eval(
return Ok(()); 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(()) Ok(())
} }

View File

@ -57,11 +57,10 @@ async fn main() {
commands::eval::eval(), commands::eval::eval(),
commands::data::data() commands::data::data()
], ],
pre_command: |ctx| { pre_command: |ctx|
Box::pin(async move { Box::pin(async move {
println!("{} ran /{}", ctx.author().name, ctx.command().name) println!("{} ran /{}", ctx.author().name, ctx.command().name)
}) }),
},
..Default::default() ..Default::default()
}).setup(|ctx, ready, framework| Box::pin(on_ready(ctx, ready, framework))) }).setup(|ctx, ready, framework| Box::pin(on_ready(ctx, ready, framework)))
.build().await.expect("Error while building the client"); .build().await.expect("Error while building the client");