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| {
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?;

View File

@ -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(())
}

View File

@ -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");