Skip to content

Commit

Permalink
Fix voting reward system
Browse files Browse the repository at this point in the history
  • Loading branch information
SunburntRock89 committed Jun 4, 2023
1 parent 78f694b commit 54b1b52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/database/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const populateBlacklistCache = () => {
prisma.$use(async(params, next) => {
// Check incoming query type
if (params.action === "deleteMany" || params.action === "updateMany") {
if (params.args.where === undefined) {
if (params.args.where === undefined && params.model !== "Votes") {
winston.error("INCREDIBLY UNSAFE QUERY DETECTED!");
return;
}
Expand Down
3 changes: 3 additions & 0 deletions src/internals/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ scheduleJob("0 20 * * 0", async() => {
user.send({ embeds: [winningEmbed] }).catch(() => null);
}

// Delete all votes
await db.votes.deleteMany({});

const announcementEmbed = new EmbedBuilder()
.setColor(config.colors.vip)
.setTitle("This week's top voters")
Expand Down

0 comments on commit 54b1b52

Please sign in to comment.