From d3e4c58c803a07e95745c689b044db39627a638f Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Thu, 9 Feb 2023 16:53:42 +0100 Subject: [PATCH] gog: only unsubscribe from newsletter if a game was claimed? --- gog.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gog.js b/gog.js index edecd5f..713c09b 100644 --- a/gog.js +++ b/gog.js @@ -122,9 +122,11 @@ try { db.data[user][title].status ||= status; notify_games.push({ title, url, status }); - console.log("Unsubscribe from 'Promotions and hot deals' newsletter"); - await page.goto('https://www.gog.com/en/account/settings/subscriptions'); - await page.locator('li:has-text("Promotions and hot deals") label').uncheck(); + if (status == 'claimed') { // TODO check if this is enough or if newsleter is enabled if 'existed' + console.log("Unsubscribe from 'Promotions and hot deals' newsletter"); + await page.goto('https://www.gog.com/en/account/settings/subscriptions'); + await page.locator('li:has-text("Promotions and hot deals") label').uncheck(); + } } } catch (error) { console.error(error); // .toString()?