1
Fork 0

Commit before deleting lots of code

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
prescientmoon 2024-08-08 15:59:36 +02:00
parent 0c90628c9d
commit d260a11263
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
14 changed files with 393 additions and 256 deletions
src/commands

View file

@ -280,7 +280,9 @@ Title error: {:?}
// }}}
// }}}
// {{{ Deliver embed
let (mut embed, attachment) = play.to_embed(&song, &chart, i, None).await?;
let (mut embed, attachment) = play
.to_embed(&ctx.data().db, &user, &song, &chart, i, None)
.await?;
if let Some(warning) = score_warning {
embed = embed.description(warning);
}
@ -401,10 +403,13 @@ pub async fn show(
creation_zeta_ptt: None,
};
let user = discord_it_to_discord_user(&ctx, &res.discord_id).await?;
let author = discord_it_to_discord_user(&ctx, &res.discord_id).await?;
let user = User::by_id(&ctx.data().db, play.user_id).await?;
let (song, chart) = ctx.data().song_cache.lookup_chart(play.chart_id)?;
let (embed, attachment) = play.to_embed(song, chart, i, Some(&user)).await?;
let (embed, attachment) = play
.to_embed(&ctx.data().db, &user, song, chart, i, Some(&author))
.await?;
embeds.push(embed);
attachments.extend(attachment);

View file

@ -73,7 +73,6 @@ pub async fn best(
};
let (song, chart) = guess_song_and_chart(&ctx.data(), &name)?;
let play = query_as!(
DbPlay,
"
@ -97,6 +96,8 @@ pub async fn best(
let (embed, attachment) = play
.to_embed(
&ctx.data().db,
&user,
&song,
&chart,
0,
@ -602,10 +603,7 @@ pub async fn b30(ctx: Context<'_>) -> Result<(), Error> {
(top_left_center, 94),
font,
style,
&format!(
"{:.2}",
(play.score.play_rating(chart.chart_constant)) as f32 / 100.
),
&format!("{:.2}", play.score.play_rating_f32(chart.chart_constant)),
)?;
Ok(())