Check matching mod when saving

This commit is contained in:
Natsu Kagami 2025-01-16 19:08:40 +01:00 committed by Natsu Kagami
parent 428ca8861f
commit a5fd4f4eab

View file

@ -333,7 +333,7 @@ pub(crate) async fn handle_save_respond(
mode: Mode, mode: Mode,
) -> Result<()> { ) -> Result<()> {
let osu_client = &env.client; let osu_client = &env.client;
async fn check(client: &OsuHttpClient, u: &User, map_id: u64) -> Result<bool> { async fn check(client: &OsuHttpClient, u: &User, mode: Mode, map_id: u64) -> Result<bool> {
Ok(client Ok(client
.user_recent(UserID::ID(u.id), |f| f.mode(Mode::Std).limit(1)) .user_recent(UserID::ID(u.id), |f| f.mode(Mode::Std).limit(1))
.await? .await?
@ -352,7 +352,7 @@ pub(crate) async fn handle_save_respond(
.next() .next()
.await; .await;
if let Some(ur) = user_reaction { if let Some(ur) = user_reaction {
if check(osu_client, &user, beatmap.beatmap_id).await? { if check(osu_client, &user, mode, beatmap.beatmap_id).await? {
break true; break true;
} }
ur.delete(&ctx).await?; ur.delete(&ctx).await?;