Skip to content

Commit

Permalink
change to watching
Browse files Browse the repository at this point in the history
  • Loading branch information
LarmuseauNiels committed Apr 25, 2023
1 parent 6ff14f1 commit 50e8f43
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
}
client.user.setActivity({
name: "flamingpalm.com",
type: "STREAMING",
type: "WATCHING",
url: "https://flamingpalm.com",
});
},
Expand Down
32 changes: 32 additions & 0 deletions modules/ApiFunctions/MemberEndPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,38 @@ export function memberEndPoints(app) {
})
.then((rewardItem) => {
console.log(rewardItem);
if (!rewardItem) {
return res.status(400).send("No items left");
}
if (rewardItem.Reward.Price > user.Points) {
return res.status(400).send("Not enough points");
}
global.client.prisma.rewardItem
.update({
where: {
RewardItemID: rewardItem.RewardItemID,
},
data: {
RedeemedBy: user.id,
RedemptionTimeStamp: new Date(),
},
})
.then((updatedRewardItem) => {
console.log(updatedRewardItem);
global.client.prisma.points.update({
where: {
userid: user.id,
},
data: {
TotalPoints: {
decrement: rewardItem.Reward.Price,
},
lastComment: "Redeemed " + rewardItem.Reward.Title,
},
});

return res.send(jsonify(updatedRewardItem));
});
});
});
}

0 comments on commit 50e8f43

Please sign in to comment.