Skip to content

Commit

Permalink
fix duplicated entries (lol)
Browse files Browse the repository at this point in the history
  • Loading branch information
PurpleCreativity committed Jan 19, 2025
1 parent 0ace750 commit 2910cf1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/interactables/points/Pointlogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,24 +221,22 @@ export default new SlashCommand({

const foundEntry = pointlog.data.find((entry) => entry.user.robloxId === actualUser.id);
if (foundEntry) {
console.log(foundEntry);
if (currentMode === addDataMode.Increment) foundEntry.points += points;
else foundEntry.points = points;

if (foundEntry.points === 0) {
pointlog.data = pointlog.data.filter(
(entry) => entry.user.robloxId !== actualUser.id,
);
continue;
}
}

if (points === 0) continue;
} else {
if (points === 0) continue;

pointlog.data.push({
points: points,
user: { robloxId: actualUser.id, robloxUsername: actualUser.username },
});
pointlog.data.push({
points: points,
user: { robloxId: actualUser.id, robloxUsername: actualUser.username },
});
}
}
} catch (error) {
const message = client.Functions.formatErrorMessage(error);
Expand Down

0 comments on commit 2910cf1

Please sign in to comment.