Skip to content

Commit ea69c76

Browse files
committed
eg: fix #449: only notify once if 'Game already in library'
1 parent 3626fc1 commit ea69c76

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

epic-games.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ try {
190190
title = await page.locator('h1').first().innerText();
191191
}
192192
const game_id = page.url().split('/').pop();
193+
const existedInDb = db.data[user][game_id];
193194
db.data[user][game_id] ||= { title, time: datetime(), url: page.url() }; // this will be set on the initial run only!
194195
console.log('Current free game:', title);
195196
if (bundle_includes) console.log(' This bundle includes:', bundle_includes);
@@ -198,7 +199,7 @@ try {
198199

199200
if (btnText == 'in library') {
200201
console.log(' Already in library! Nothing to claim.');
201-
await notify(`Game already in library: ${url}`);
202+
if (!existedInDb) await notify(`Game already in library: ${url}`);
202203
notify_game.status = 'existed';
203204
db.data[user][game_id].status ||= 'existed'; // does not overwrite claimed or failed
204205
if (db.data[user][game_id].status.startsWith('failed')) db.data[user][game_id].status = 'manual'; // was failed but now it's claimed

0 commit comments

Comments
 (0)