diff --git a/src/classes/Client.js b/src/classes/Client.js index 1c6e847..5f74012 100644 --- a/src/classes/Client.js +++ b/src/classes/Client.js @@ -404,7 +404,8 @@ export default class Client { async cashout(catchall) { if (!catchall) throw new Error('No catchall was provided.'); - this.email = `${faker.internet.userName()}@${catchall}`; + if (catchall.includes('@')) this.email = catchall; + else this.email = `${faker.internet.userName()}@${catchall}`; const { body } = await request.promise('https://api-quiz.hype.space/users/me/payouts', { method: 'POST', diff --git a/src/modules/hq-cashout.js b/src/modules/hq-cashout.js index 6ef41ff..358716b 100644 --- a/src/modules/hq-cashout.js +++ b/src/modules/hq-cashout.js @@ -33,7 +33,7 @@ export default async () => { clients.push(client); - const { balance, eligibleForPayout } = await client.getBalance(); + const { available: balance, eligibleForPayout } = await client.getBalance(); const { lives, erase1s } = await client.getUserData(); livesCount += lives; @@ -75,14 +75,24 @@ export default async () => { if (!num) return console.log('Canceling...'); if (num > accounts.length) return console.log(`Only ${accounts.length} account(s) are able to cashout.`.red); - const { catchall } = await prompt({ - type: 'input', - name: 'catchall', - message: 'What catchall would you like to use?', - }); + let email; + + if (num === 1) { + ({ email } = await prompt({ + type: 'input', + name: 'email', + message: 'What email would you like to cashout to?', + })); + } else { + ({ catchall: email } = await prompt({ + type: 'input', + name: 'catchall', + message: 'What catchall would you like to use?', + })); + } for (let i = 0; i < num; i += 1) { - await accounts[i].cashout(catchall); + await accounts[i].cashout(email); } console.log(`Finished cashing out ${num} account(s)!`.green);