|
|
|
@ -54,18 +54,32 @@ export class Player { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async updateCurrentElo() { |
|
|
|
|
let entries; |
|
|
|
|
try { |
|
|
|
|
entries = await riotAPI.league.getEntriesBySummonerId({ |
|
|
|
|
region: PlatformId.EUW1, |
|
|
|
|
const tryRegion = async (region: RiotAPITypes.LoLRegion) => { |
|
|
|
|
return await riotAPI.league.getEntriesBySummonerId({ |
|
|
|
|
region: region, |
|
|
|
|
summonerId: (await riotAPI.summoner.getByPUUID({ |
|
|
|
|
region: PlatformId.EUW1, |
|
|
|
|
region: region, |
|
|
|
|
puuid: this.puuid |
|
|
|
|
})).id |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let entries; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
entries = await tryRegion(PlatformId.EUW1); |
|
|
|
|
} catch (error){ |
|
|
|
|
console.error(await(error as Response).json()); |
|
|
|
|
return; |
|
|
|
|
let response = error as Response; |
|
|
|
|
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"); |
|
|
|
|