added eune support

main
Benjamin Kraft 4 months ago
parent 51ea3a4e52
commit 256e5a607e
  1. 28
      src/player.ts

@ -54,18 +54,32 @@ export class Player {
} }
async updateCurrentElo() { async updateCurrentElo() {
let entries; const tryRegion = async (region: RiotAPITypes.LoLRegion) => {
try { return await riotAPI.league.getEntriesBySummonerId({
entries = await riotAPI.league.getEntriesBySummonerId({ region: region,
region: PlatformId.EUW1,
summonerId: (await riotAPI.summoner.getByPUUID({ summonerId: (await riotAPI.summoner.getByPUUID({
region: PlatformId.EUW1, region: region,
puuid: this.puuid puuid: this.puuid
})).id })).id
}); });
};
let entries;
try {
entries = await tryRegion(PlatformId.EUW1);
} catch (error){ } catch (error){
console.error(await(error as Response).json()); let response = error as Response;
return; console.error(await response.json());
console.log(`Trying EUNE Region...`);
try {
entries = await tryRegion(PlatformId.EUNE1);
console.log(`Success with EUNE`);
} catch (error){
let response = error as Response;
console.error(await response.json());
return;
}
} }
let soloQ = entries.find(e => e.queueType == "RANKED_SOLO_5x5"); let soloQ = entries.find(e => e.queueType == "RANKED_SOLO_5x5");

Loading…
Cancel
Save