39 lines
1004 B
JavaScript
39 lines
1004 B
JavaScript
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'));
|
|
}
|
|
}
|
|
);
|
|
});
|