1.0.7 Hotfix

This commit is contained in:
TheNetsky
2023-10-08 16:16:54 +02:00
parent 508be231f2
commit 085db76f4c
2 changed files with 11 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ Under development, however mainly for personal use!
- [ ] Completing Punchcards
- [ ] Solving This Or That Quiz
- [x] Clicking Promotional Items
- [x] Solving ABC quiz
- [x] Solving ABC Quiz
- [ ] Completing Shop And Earn
- [ ] Proxy Support

View File

@@ -21,7 +21,10 @@ export async function doABC(page: Page, data: PromotionalItem | MorePromotion) {
await wait(2000)
let $ = await refreshCheerio(abcPage)
while (!$('span.rw_icon').length) {
// Don't loop more than 15 in case unable to solve, would lock otherwise
const maxIterations = 15
let i
for (i = 0; i < maxIterations && !$('span.rw_icon').length; i++) {
await abcPage.waitForSelector('.wk_OptionClickClass', { visible: true, timeout: 5000 })
const answers = $('.wk_OptionClickClass')
@@ -44,7 +47,12 @@ export async function doABC(page: Page, data: PromotionalItem | MorePromotion) {
await wait(4000)
await abcPage.close()
log('ABC', 'Completed the ABC successfully')
if (i === maxIterations) {
log('ABC', 'Failed to solve quiz, exceeded max iterations of 15', 'warn')
} else {
log('ABC', 'Completed the ABC successfully')
}
} catch (error) {
const abcPage = await getLatestTab(page)
await abcPage.close()