Skip to content

Commit

Permalink
fix: re-impl URL params
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Nov 12, 2023
1 parent ba2f974 commit 40b37e6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion common/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { Client, EmbedBuilder } from 'discord.js'
import { priceFormat } from './utils.js'
import fs from 'fs'
import { parseParams, priceFormat } from './utils.js'

export async function sendNotifications(bot: Client, notifications: NotificationData[]) {
const config: Config = JSON.parse(fs.readFileSync('./config.json').toString())

for (const notif of notifications) {
// If we have url_params, add them to the URL
if (Object.keys(config.url_params).length > 0) {
notif.link += parseParams(config.url_params)
}

if (notif.oldPrice === 0 && notif.newPrice !== 0) {
// Old price was 0 but new price isn't? Item is now in stock!
await sendInStock(bot, notif)
Expand Down

0 comments on commit 40b37e6

Please sign in to comment.