Put ranked status on information

This commit is contained in:
Natsu Kagami 2020-08-09 22:33:42 -04:00
parent 3bb2154161
commit 572b17b715
No known key found for this signature in database
GPG key ID: F17543D4B9424B94
2 changed files with 12 additions and 2 deletions

View file

@ -259,7 +259,6 @@ pub(crate) fn score_embed<'a>(
s.date.format("%F %T"), s.date.format("%F %T"),
)) ))
.image(b.cover_url()) .image(b.cover_url())
.field("Map stats", diff.format_info(mode, s.mods, b), false)
.field( .field(
"Score stats", "Score stats",
format!( format!(
@ -278,6 +277,7 @@ pub(crate) fn score_embed<'a>(
), ),
true, true,
) )
.field("Map stats", diff.format_info(mode, s.mods, b), false)
.timestamp(&s.date); .timestamp(&s.date);
if mode.to_oppai_mode().is_none() && s.mods != Mods::NOMOD { if mode.to_oppai_mode().is_none() && s.mods != Mods::NOMOD {
m.footer(|f| f.text("Star difficulty does not reflect game mods.")); m.footer(|f| f.text("Star difficulty does not reflect game mods."));

View file

@ -126,13 +126,18 @@ impl Difficulty {
/// Format the difficulty info into a short summary. /// Format the difficulty info into a short summary.
pub fn format_info(&self, mode: Mode, mods: Mods, original_beatmap: &Beatmap) -> String { pub fn format_info(&self, mode: Mode, mods: Mods, original_beatmap: &Beatmap) -> String {
let is_not_ranked = match original_beatmap.approval {
ApprovalStatus::Ranked(_) => false,
_ => true,
};
let three_lines = is_not_ranked;
MessageBuilder::new() MessageBuilder::new()
.push(format!( .push(format!(
"[[Link]]({}) (`{}`)", "[[Link]]({}) (`{}`)",
original_beatmap.link(), original_beatmap.link(),
original_beatmap.short_link(Some(mode), Some(mods)) original_beatmap.short_link(Some(mode), Some(mods))
)) ))
.push(", ") .push(if three_lines { "\n" } else { ", " })
.push_bold(format!("{:.2}", self.stars)) .push_bold(format!("{:.2}", self.stars))
.push(", ") .push(", ")
.push( .push(
@ -142,6 +147,11 @@ impl Difficulty {
.map(|c| format!("max **{}x**, ", c)) .map(|c| format!("max **{}x**, ", c))
.unwrap_or_else(|| "".to_owned()), .unwrap_or_else(|| "".to_owned()),
) )
.push(if is_not_ranked {
format!("status **{}**, mode ", original_beatmap.approval)
} else {
"".to_owned()
})
.push_bold_line(format_mode(mode, original_beatmap.mode)) .push_bold_line(format_mode(mode, original_beatmap.mode))
.push("CS") .push("CS")
.push_bold(format!("{:.1}", self.cs)) .push_bold(format!("{:.1}", self.cs))