Aesthetics change to embeds

- Beatmap drain time now shown in shorten state
- Play embed uses thumbnail instead of image
- User top play now show full stats
This commit is contained in:
Natsu Kagami 2022-01-19 17:52:34 -05:00
parent e5a74d87e1
commit 68da7c3f4d
Signed by: nki
GPG key ID: 7306B3D3C3AD6E51
2 changed files with 18 additions and 20 deletions

View file

@ -328,21 +328,12 @@ impl<'a> ScoreEmbedBuilder<'a> {
world_record, world_record,
)) ))
.description(format!( .description(format!(
r#"**Beatmap**: {} - {} [{}]**{} ** r#"**Played**: {}
**Links**: [[Listing]]({}) [[Download]]({}) [[Bloodcat]]({})
**Played**: {}
{}"#, {}"#,
b.artist,
b.title,
b.difficulty_name,
s.mods,
b.link(),
b.download_link(false),
b.download_link(true),
s.date.format("<t:%s:R>"), s.date.format("<t:%s:R>"),
pp_gained.as_ref().map(|v| &v[..]).unwrap_or(""), pp_gained.as_ref().map(|v| &v[..]).unwrap_or(""),
)) ))
.image(b.cover_url()) .thumbnail(b.thumbnail_url())
.field( .field(
"Score stats", "Score stats",
format!( format!(
@ -361,8 +352,7 @@ impl<'a> ScoreEmbedBuilder<'a> {
), ),
true, true,
) )
.field("Map stats", diff.format_info(mode, s.mods, b), false) .field("Map stats", diff.format_info(mode, s.mods, b), false);
.timestamp(&s.date);
let mut footer = self.footer.take().unwrap_or_else(String::new); let mut footer = self.footer.take().unwrap_or_else(String::new);
if mode.to_oppai_mode().is_none() && s.mods != Mods::NOMOD { if mode.to_oppai_mode().is_none() && s.mods != Mods::NOMOD {
footer += " Star difficulty does not reflect game mods."; footer += " Star difficulty does not reflect game mods.";
@ -450,12 +440,14 @@ pub(crate) fn user_embed(
MessageBuilder::new().push_bold_safe(&map.title).build(), MessageBuilder::new().push_bold_safe(&map.title).build(),
map.difficulty_name, map.difficulty_name,
map.link(), map.link(),
v.mods v.mods,
)) ))
.push(format!( .push(format!(
"{:.1}⭐ | `{}`", "> {}",
info.map(|i| i.stars as f64).unwrap_or(map.difficulty.stars), map.difficulty
map.short_link(Some(mode), Some(v.mods)) .apply_mods(v.mods, info.map(|i| i.stars as f64))
.format_info(mode, v.mods, &map)
.replace("\n", "\n> ")
)) ))
.build(), .build(),
false, false,

View file

@ -3,7 +3,6 @@ use regex::Regex;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt; use std::fmt;
use std::time::Duration; use std::time::Duration;
use youmubot_prelude::Duration as YoumuDuration;
pub mod mods; pub mod mods;
pub mod parse; pub mod parse;
@ -136,8 +135,10 @@ impl Difficulty {
let bpm = (self.bpm * 100.0).round() / 100.0; let bpm = (self.bpm * 100.0).round() / 100.0;
MessageBuilder::new() MessageBuilder::new()
.push(format!( .push(format!(
"[[Link]]({}) (`{}`)", "[[Link]]({}) [[DL]]({}) [[Alt]]({}) (`{}`)",
original_beatmap.link(), original_beatmap.link(),
original_beatmap.download_link(false),
original_beatmap.download_link(true),
original_beatmap.short_link(Some(mode), Some(mods)) original_beatmap.short_link(Some(mode), Some(mods))
)) ))
.push(if three_lines { "\n" } else { ", " }) .push(if three_lines { "\n" } else { ", " })
@ -166,7 +167,12 @@ impl Difficulty {
.push_bold(format!("{:.1}", self.hp)) .push_bold(format!("{:.1}", self.hp))
.push(format!(", BPM**{}**", bpm)) .push(format!(", BPM**{}**", bpm))
.push(", ⌛ ") .push(", ⌛ ")
.push_bold(format!("{}", YoumuDuration(self.drain_length))) .push({
let length = self.drain_length;
let minutes = length.as_secs() / 60;
let seconds = length.as_secs() % 60;
format!("**{}:{:02}** (drain)", minutes, seconds)
})
.build() .build()
} }
} }