From ea69c76b5016e17cfb58d49764990b6459c99e20 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Tue, 11 Mar 2025 10:14:42 +0100 Subject: [PATCH] eg: fix #449: only notify once if 'Game already in library' --- epic-games.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epic-games.js b/epic-games.js index 9aa4482..f03350f 100644 --- a/epic-games.js +++ b/epic-games.js @@ -190,6 +190,7 @@ try { title = await page.locator('h1').first().innerText(); } const game_id = page.url().split('/').pop(); + const existedInDb = db.data[user][game_id]; db.data[user][game_id] ||= { title, time: datetime(), url: page.url() }; // this will be set on the initial run only! console.log('Current free game:', title); if (bundle_includes) console.log(' This bundle includes:', bundle_includes); @@ -198,7 +199,7 @@ try { if (btnText == 'in library') { console.log(' Already in library! Nothing to claim.'); - await notify(`Game already in library: ${url}`); + if (!existedInDb) await notify(`Game already in library: ${url}`); notify_game.status = 'existed'; db.data[user][game_id].status ||= 'existed'; // does not overwrite claimed or failed if (db.data[user][game_id].status.startsWith('failed')) db.data[user][game_id].status = 'manual'; // was failed but now it's claimed