-
-
Save delasy/7ef35c70cafe3c565949af6784a5b291 to your computer and use it in GitHub Desktop.
// insert hamster-kombat-playground-games-promo-keys-generator.js here | |
// with removed `async function main() {...}` and `main().catch(Logger.panic);` | |
const { CronJob } = require('cron'); | |
const HK_TOKEN = '<api-token>'; | |
async function applyPromo(promoCode) { | |
await fetch('https://api.hamsterkombatgame.io/clicker/apply-promo', { | |
method: 'POST', | |
headers: { | |
Authorization: `Bearer ${HK_TOKEN}`, | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify({ promoCode }), | |
}); | |
} | |
async function applyPromoCron(gameKey) { | |
const gp = new GamePromo(); | |
for (let j = 0; j < 4; j++) { | |
const promoCode = await gp.getCode(gameKey); | |
await applyPromo(promoCode); | |
} | |
} | |
const jobs = [ | |
{ | |
schedule: '0 42 10 * * *', | |
command: async () => applyPromoCron('BIKE'), | |
}, | |
{ | |
schedule: '0 15 12 * * *', | |
command: async () => applyPromoCron('TRAIN'), | |
}, | |
{ | |
schedule: '0 31 14 * * *', | |
command: async () => applyPromoCron('CUBE'), | |
}, | |
{ | |
schedule: '0 21 16 * * *', | |
command: async () => applyPromoCron('CLONE'), | |
}, | |
{ | |
schedule: '0 36 18 * * *', | |
command: async () => applyPromoCron('MERGE'), | |
}, | |
{ | |
schedule: '0 12 20 * * *', | |
command: async () => applyPromoCron('TWERK'), | |
}, | |
{ | |
schedule: '0 21 22 * * *', | |
command: async () => applyPromoCron('POLY'), | |
}, | |
]; | |
jobs.forEach((job) => { | |
CronJob.from({ | |
cronTime: job.schedule, | |
onTick: job.command, | |
start: true, | |
timeZone: 'utc', | |
}); | |
}); |
const { CronJob } = require('cron'); | |
const HK_TOKEN = '<api-token>'; | |
function sync() { | |
const randomMinute = Math.floor(Math.random() * 60); | |
setTimeout(() => { | |
fetch('https://api.hamsterkombatgame.io/clicker/sync', { | |
method: 'POST', | |
headers: { | |
Authorization: `Bearer ${HK_TOKEN}`, | |
'Content-Type': 'application/json', | |
} | |
}); | |
}, randomMinute * 60_000); | |
} | |
CronJob.from({ | |
cronTime: '0 0 */2 * * *', | |
onTick: sync, | |
start: true, | |
timeZone: 'utc', | |
}); |
Isn't it the same IP when I run Hamster Kombat on a machine and a device (phone) that are connected to the same Wi-Fi?
should be same IP, not sure what configuration you have
Isn't it the same IP when I run Hamster Kombat on a machine and a device (phone) that are connected to the same Wi-Fi?
should be same IP, not sure what configuration you have
I have this sync js you provided running on the same internet connection
Isn't it the same IP when I run Hamster Kombat on a machine and a device (phone) that are connected to the same Wi-Fi?
should be same IP, not sure what configuration you have
I have this sync js you provided running on the same internet connection
@delasy ??
@delasy ??
what's your question?
Isn't it the same IP when I run Hamster Kombat on a machine and a device (phone) that are connected to the same Wi-Fi?
should be same IP, not sure what configuration you have
what do you mean by configuration? I have this sync js you provided running on the same internet connection
what do you mean by configuration? I have this sync js you provided running on the same internet connection
then you should be good
Isn't it the same IP when I run Hamster Kombat on a machine and a device (phone) that are connected to the same Wi-Fi?