pg: skip if user has no Prime membership, closes #76?

This commit is contained in:
Ralf Vogler 2023-02-24 12:31:42 +01:00
parent dc28c30e7b
commit cc39b4b3d1

View file

@ -85,6 +85,12 @@ try {
// console.log(`Twitch user name is ${twitch}`); // console.log(`Twitch user name is ${twitch}`);
db.data[user] ||= {}; db.data[user] ||= {};
if (await page.getByRole('button', { name: 'Try Prime' }).count()) {
console.error('User is currently not an Amazon Prime member, so no games to claim. Exit!');
await context.close();
process.exit(1);
}
await page.click('button[data-type="Game"]'); await page.click('button[data-type="Game"]');
const games_sel = 'div[data-a-target="offer-list-FGWP_FULL"]'; const games_sel = 'div[data-a-target="offer-list-FGWP_FULL"]';
await page.waitForSelector(games_sel); await page.waitForSelector(games_sel);