fetching match data!
This commit is contained in:
parent
b3b6fbdb9e
commit
8aeb15806c
1 changed files with 25 additions and 8 deletions
33
index.mjs
33
index.mjs
|
@ -11,9 +11,11 @@ const config = {
|
||||||
client: "redis://redis:6379", // leave null if client is local
|
client: "redis://redis:6379", // leave null if client is local
|
||||||
ttls: {
|
ttls: {
|
||||||
byMethod: {
|
byMethod: {
|
||||||
[METHOD_KEY.SUMMONER.GET_BY_SUMMONER_NAME]: 24 * 60 * 60 * 100, // ms
|
[METHOD_KEY.SUMMONER.GET_BY_SUMMONER_NAME]: 24 * 60 * 60 * 100, // 1 day
|
||||||
[METHOD_KEY.MATCH_V5.GET_IDS_BY_PUUID]: 24 * 60 * 60 * 100, // ms
|
[METHOD_KEY.MATCH_V5.GET_IDS_BY_PUUID]: 24 * 60 * 60 * 100, // 1 day
|
||||||
[METHOD_KEY.MATCH.GET_MATCHLIST_BY_ACCOUNT]: 24 * 60 * 60 * 100, // ms
|
[METHOD_KEY.MATCH_V5.GET_MATCH_BY_ID]: 24 * 60 * 60 * 100, // 1 day
|
||||||
|
// TODO: Figure out if I can get more games with old API?
|
||||||
|
// [METHOD_KEY.MATCH.GET_MATCHLIST_BY_ACCOUNT]: 24 * 60 * 60 * 100, // ms
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -35,13 +37,28 @@ const ice = await rAPI.summoner
|
||||||
})
|
})
|
||||||
.then(({ name, puuid }) => ({ name, puuid }));
|
.then(({ name, puuid }) => ({ name, puuid }));
|
||||||
|
|
||||||
const valGames = await get_games_by_puuid(val.puuid);
|
const valGameIds = await get_games_by_puuid(val.puuid);
|
||||||
const iceGames = await get_games_by_puuid(ice.puuid);
|
const iceGamesIds = await get_games_by_puuid(ice.puuid);
|
||||||
|
|
||||||
const commonGames = valGames.filter(Set.prototype.has, new Set(iceGames));
|
const commonGameIds = valGameIds.filter(
|
||||||
|
Set.prototype.has,
|
||||||
|
new Set(iceGamesIds),
|
||||||
|
);
|
||||||
|
|
||||||
console.log(`Common Games Found: ${commonGames.length}`);
|
console.log(`Common Games Found: ${commonGameIds.length}`);
|
||||||
console.log(`${JSON.stringify(commonGames, null, " ")}`);
|
console.log(`${JSON.stringify(commonGameIds, null, " ")}`);
|
||||||
|
|
||||||
|
let commonGames = [];
|
||||||
|
for (const matchId of commonGameIds) {
|
||||||
|
const game = await rAPI.matchV5.getMatchById({
|
||||||
|
cluster: PlatformId.AMERICAS,
|
||||||
|
matchId,
|
||||||
|
});
|
||||||
|
|
||||||
|
commonGames.push(game);
|
||||||
|
|
||||||
|
console.log(JSON.stringify(game));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} puuid
|
* @param {string} puuid
|
||||||
|
|
Loading…
Reference in a new issue