Skip to content

Commit

Permalink
Fix mastery now being by puuid instead of summonerId
Browse files Browse the repository at this point in the history
  • Loading branch information
KwikKill committed Dec 14, 2023
1 parent d9876e3 commit 5724eee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions util/lol_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ class LolApi {
* @param {*} summonerId summoner id
* @returns {Object} champion mastery data
*/
async championmasteriesBySummoner(apiKey, region, summonerId, client) {
async championmasteriesBySummoner(apiKey, region, puuid, client) {
this.checkRegion(region, client);
const url = "https://" + region + ".api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/" + summonerId + "?api_key=" + apiKey;
const url = "https://" + region + ".api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-puuid/" + puuid + "?api_key=" + apiKey;
return await this.apiCall(url, client);
}

Expand Down
3 changes: 1 addition & 2 deletions util/lol_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ module.exports = {
const masteries = {};
const query = await this.client.pg.query("SELECT * FROM summoners WHERE discordid = '" + discordid + "'");
for (const x of query.rows) {
const response = await this.lol_api.championmasteriesBySummoner(this.apiKey, region, x.id, this.client);
console.log(response);
const response = await this.lol_api.championmasteriesBySummoner(this.apiKey, region, x.puuid, this.client);
for (const y of response) {
if (masteries[y.championId] === undefined) {
masteries[y.championId] = y;
Expand Down

0 comments on commit 5724eee

Please sign in to comment.