Skip to content

Commit

Permalink
additional checks for being on the wrong page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Chapiewsky committed Apr 7, 2019
1 parent ee1f357 commit b8bd5f1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/giveaways.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ async function enterVideoGiveaway(page) {
async function enterGiveaways(page, pageNumber) {
//loop through each giveaway item
console.log('Page ' + pageNumber + ' Start:');
let giveawayExists = true;
const giveawayKeys = new Array(24);
await asyncForEach(giveawayKeys, async (val, index) => {
let i = index + 1;
Expand All @@ -280,6 +281,15 @@ async function enterGiveaways(page, pageNumber) {
);
} catch (error) {
console.log('giveaway ' + i + ' did not exist?');
giveawayExists = false;
}

if (!giveawayExists) {
// it's weird that it couldn't find a giveaway, let's make sure we
// aren't on some other page...
await checkForSwitchAccount(page);
await checkForPassword(page);
await checkForCaptcha(page);
return;
}

Expand Down

0 comments on commit b8bd5f1

Please sign in to comment.