From fdae8be75b1e58fe954bbb5fc903f541cf878230 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Sun, 11 Feb 2024 17:57:26 +0100 Subject: [PATCH] Improve formatting slightly --- youmubot-osu/src/discord/embeds.rs | 36 +++++++++++++++---------- youmubot-osu/src/discord/server_rank.rs | 2 +- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/youmubot-osu/src/discord/embeds.rs b/youmubot-osu/src/discord/embeds.rs index 4e6a240..7b67c35 100644 --- a/youmubot-osu/src/discord/embeds.rs +++ b/youmubot-osu/src/discord/embeds.rs @@ -368,19 +368,27 @@ impl<'a> ScoreEmbedBuilder<'a> { }; m.author(|f| f.name(&u.username).url(u.link()).icon_url(u.avatar_url())) .color(0xffb6c1) - .title(format!( - "{} | {} - {} [{}] {} ({:.2}\\*) {}| {} {} {}", - u.username, - b.artist, - b.title, - b.difficulty_name, - s.mods, - stars, - creator, - score_line, - top_record, - world_record, - )) + .title( + MessageBuilder::new() + .push_safe(&u.username) + .push(" | ") + .push_safe(&b.artist) + .push(" - ") + .push(&b.title) + .push(" [") + .push_safe(&b.difficulty_name) + .push("] ") + .push(s.mods) + .push(" ") + .push(format!("({:.2}\\*)", stars)) + .push(" ") + .push_safe(creator) + .push("| ") + .push(score_line) + .push(top_record) + .push(world_record) + .build(), + ) .description(format!( r#"**Played**: {} {}"#, @@ -423,7 +431,7 @@ pub(crate) fn user_embed( best: Option<(Score, BeatmapWithMode, BeatmapInfo)>, m: &mut CreateEmbed, ) -> &mut CreateEmbed { - m.title(u.username) + m.title(MessageBuilder::new().push_safe(u.username).build()) .url(format!("https://osu.ppy.sh/users/{}", u.id)) .color(0xffb6c1) .thumbnail(format!("https://a.ppy.sh/{}", u.id)) diff --git a/youmubot-osu/src/discord/server_rank.rs b/youmubot-osu/src/discord/server_rank.rs index f717013..9cfffdd 100644 --- a/youmubot-osu/src/discord/server_rank.rs +++ b/youmubot-osu/src/discord/server_rank.rs @@ -137,7 +137,7 @@ pub async fn server_rank(ctx: &Context, m: &Message, mut args: Args) -> CommandR mw = member_len )); for (id, (pp, (member, u))) in users.iter().enumerate() { - content.push_line_safe(format!( + content.push_line(format!( "{:>4} | {:>8.2} | {:uw$} | {}", format!("#{}", 1 + id + start), pp,