Skip to content

Commit

Permalink
Remplacement de l'API d'obtention des UUIDs de playerdb à Mojang
Browse files Browse the repository at this point in the history
  • Loading branch information
Niilyx committed Aug 26, 2023
1 parent 49f8a91 commit c95102c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ async function getMcUUID(username) {
});
} catch (e) {
console.error(`Error while fetching Mojang API for player: ${username}`);
console.error(e);
return null;
}
let { id } = await res.json();
return dashify(id)
let json = await res.json();
if (!json.id && json.errorMessage) {
console.error(`Player: ${username} does not exist.`);
console.error(`Mojang responded: ${json.errorMessage}`)
return null;
}
return dashify(json.id)
}

async function getUserRanks(discordMember) {
Expand Down

0 comments on commit c95102c

Please sign in to comment.