Add weekly lives and format account summary cleaner
This commit is contained in:
@@ -31,6 +31,7 @@ players.forEach((player) => {
|
||||
playersReturned++;
|
||||
try {
|
||||
const result = JSON.parse(body);
|
||||
const { lives } = result;
|
||||
let gamesPlayed = 0;
|
||||
let winCount = 0;
|
||||
let winRatio = 0;
|
||||
@@ -53,9 +54,8 @@ players.forEach((player) => {
|
||||
console.log(formatString, `\n\nPlayer ${player.username}:`);
|
||||
console.log(formatString, '===================================');
|
||||
|
||||
console.log(formatString, ` Games Played: ${gamesPlayed}`);
|
||||
console.log(formatString, ` Games Won: ${winCount}`);
|
||||
console.log(formatString, ` Win Percentage: ${winRatio}%`);
|
||||
console.log(formatString, ` ${winRatio}% Won (${gamesPlayed} played with ${winCount} wins)`);
|
||||
console.log(formatString, ` ${lives} lives remaining!`);
|
||||
|
||||
const balance = result.leaderboard.unclaimed;
|
||||
const { total } = result.leaderboard;
|
||||
|
||||
38
makeItRain.js
Normal file
38
makeItRain.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import request from 'request';
|
||||
|
||||
import { players } from './config.json';
|
||||
|
||||
const HOST = 'api-quiz.hype.space';
|
||||
const headers = {
|
||||
'x-hq-client': 'Android/1.12.2',
|
||||
'content-type': 'application/json; charset=UTF-8',
|
||||
'user-agent': 'okhttp/3.8.0',
|
||||
};
|
||||
|
||||
console.log(`You have ${players.length} players available!`);
|
||||
|
||||
players.forEach((player) => {
|
||||
request({
|
||||
method: 'POST',
|
||||
url: 'https://api-quiz.hype.space/easter-eggs/makeItRain',
|
||||
headers: {
|
||||
...headers,
|
||||
authorization: `Bearer ${player.accessToken}`,
|
||||
}
|
||||
}, (error, response, body) => {
|
||||
console.log();
|
||||
try {
|
||||
const result = JSON.parse(body);
|
||||
const { error } = result;
|
||||
|
||||
if (error) {
|
||||
console.log(`${player.username} already has claimed weekly life!`);
|
||||
} else {
|
||||
console.log(`${player.username} has been given a life!`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`${player.username} error:\n`, body.toString('utf8'));
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -10,7 +10,8 @@
|
||||
"summary": "babel-node accountSummary.js --presets env,es2016,stage-2",
|
||||
"avatar": "babel-node changeAvatar.js --presets env,es2016,stage-2",
|
||||
"cashout": "babel-node cashout.js --presets env,es2016,stage-2",
|
||||
"answers": "babel-node getWeightedAnswers.js --presets env,es2016,stage-2"
|
||||
"answers": "babel-node getWeightedAnswers.js --presets env,es2016,stage-2",
|
||||
"weekly": "babel-node makeItRain.js --presets env,es2016,stage-2"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
|
||||
Reference in New Issue
Block a user