gog: only unsubscribe from newsletter if a game was claimed?

This commit is contained in:
Ralf Vogler 2023-02-09 16:53:42 +01:00
parent 11a28f0c73
commit d3e4c58c80

2
gog.js
View file

@ -122,10 +122,12 @@ try {
db.data[user][title].status ||= status;
notify_games.push({ title, url, status });
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()?
if (error.message && !error.message.includes('Target closed') && !error.message.includes('Browser closed')) // e.g. when killed by Ctrl-C