Skip to content

Commit

Permalink
fix: nonzero prices
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Nov 23, 2023
1 parent dde9ae6 commit 7d5a0f8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export async function sendNotifications(bot: Client, notifications: Notification
const meetsPricePercentage = notif.pricePercentage ? notif.newPrice <= (notif.oldPrice - (notif.oldPrice * (notif.pricePercentage / 100))) : true
const meetsDifference = notif.difference ? notif.newPrice < (notif.oldPrice - notif.difference) : true

if (meetsPriceLimit && meetsPricePercentage && meetsDifference) {
// Prices being zero just means the item is out of stock
const priceNotZero = notif.newPrice !== 0

if (meetsPriceLimit && meetsPricePercentage && meetsDifference && priceNotZero) {
await sendPriceChange(bot, notif)
}
}
Expand Down

0 comments on commit 7d5a0f8

Please sign in to comment.