Skip to content

Commit 40b37e6

Browse files
committed
fix: re-impl URL params
1 parent ba2f974 commit 40b37e6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

common/notifications.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import { Client, EmbedBuilder } from 'discord.js'
2-
import { priceFormat } from './utils.js'
2+
import fs from 'fs'
3+
import { parseParams, priceFormat } from './utils.js'
34

45
export async function sendNotifications(bot: Client, notifications: NotificationData[]) {
6+
const config: Config = JSON.parse(fs.readFileSync('./config.json').toString())
7+
58
for (const notif of notifications) {
9+
// If we have url_params, add them to the URL
10+
if (Object.keys(config.url_params).length > 0) {
11+
notif.link += parseParams(config.url_params)
12+
}
13+
614
if (notif.oldPrice === 0 && notif.newPrice !== 0) {
715
// Old price was 0 but new price isn't? Item is now in stock!
816
await sendInStock(bot, notif)

0 commit comments

Comments
 (0)