fetching common game ids

main
Zynh0722 2024-02-08 04:15:34 -08:00
parent 45a8083857
commit b3b6fbdb9e
2 changed files with 4 additions and 11 deletions

View File

@ -5,6 +5,7 @@ const METHOD_KEY = RiotAPITypes.METHOD_KEY;
/** @type {RiotAPITypes.Config} */
const config = {
debug: false,
cache: {
cacheType: "ioredis", // local or ioredis
client: "redis://redis:6379", // leave null if client is local
@ -34,14 +35,12 @@ const ice = await rAPI.summoner
})
.then(({ name, puuid }) => ({ name, puuid }));
console.log(`${JSON.stringify(val, null, " ")}`);
console.log(`${JSON.stringify(ice, null, " ")}`);
const valGames = await get_games_by_puuid(val.puuid);
const iceGames = await get_games_by_puuid(ice.puuid);
const commonGames = valGames.filter(Set.prototype.has, new Set(iceGames));
console.log(`Common Games Found: ${commonGames.length}`);
console.log(`${JSON.stringify(commonGames, null, " ")}`);
/**
@ -53,10 +52,9 @@ async function get_games_by_puuid(puuid) {
let start = 0;
while (start >= 0) {
console.log(`getting entries ${start}-${start + 19}`);
let newGames = await rAPI.matchV5.getIdsByPuuid({
cluster: PlatformId.AMERICAS,
puuid: val.puuid,
puuid,
params: {
start,
},

View File

@ -5,7 +5,7 @@
"main": "index.mjs",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "DEBUG=riotapi* node --no-deprecation index.mjs"
"start": "node --no-deprecation index.mjs"
},
"author": "",
"license": "MIT",
@ -14,10 +14,5 @@
},
"devDependencies": {
"nodemon": "^3.0.3"
},
"nodemonConfig": {
"env": {
"DEBUG": "riotapi*"
}
}
}