mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-21 01:38:55 +00:00
Put ranked status on information
This commit is contained in:
parent
3bb2154161
commit
572b17b715
2 changed files with 12 additions and 2 deletions
|
@ -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."));
|
||||||
|
|
|
@ -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))
|
||||||
|
|
Loading…
Add table
Reference in a new issue