Skip to content

Commit

Permalink
Fix desynchronized recent index in comparison with recent5
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian8337 committed Jun 10, 2024
1 parent a3ce1bd commit daa44d1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/interactions/commands/osu! and osu!droid/recent/recent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ export const run: SlashCommand["run"] = async (_, interaction) => {
} else {
const recentPlays = await DroidHelper.getRecentScores(
player.id,
1,
index - 1,
undefined,
undefined,
[
"id",
"hash",
Expand All @@ -173,13 +173,21 @@ export const run: SlashCommand["run"] = async (_, interaction) => {
"mark",
"date",
],
).then(async (res) =>
).then((res) =>
considerNonOverwrite
? await ScoreHelper.getRecentScores(player.id, res)
? ScoreHelper.getRecentScores(player.id, res)
: res,
);

score = recentPlays[0];
if (recentPlays.length === 0) {
return InteractionHelper.reply(interaction, {
content: MessageCreator.createReject(
localization.getTranslation("playerHasNoRecentPlays"),
),
});
}

score = recentPlays[index - 1];
}

if (!score) {
Expand Down

0 comments on commit daa44d1

Please sign in to comment.