Skip to content

Commit

Permalink
change username -> uuid provider
Browse files Browse the repository at this point in the history
  • Loading branch information
builder-247 committed Sep 15, 2022
1 parent ade9050 commit 75c35d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions store/getUUID.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ async function getUUID(name) {
}

return cachedFunction(`uuid:${name.toLowerCase()}`, async () => {
const url = `https://playerdb.co/api/player/minecraft/${name}`;
const url = `https://api.ashcon.app/mojang/v2/user/${name}`;

const response = await getData(redis, url);
if (!response) {
throw new Error('Invalid username!');
}

const { data } = response;
return data.player.raw_id;
return removeDashes(response.uuid);
}, { cacheDuration: config.UUID_CACHE_SECONDS, shouldCache: config.ENABLE_UUID_CACHE });
}

Expand Down
2 changes: 1 addition & 1 deletion util/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ const getData = fromPromise(async (redis, url) => {

const urlData = urllib.parse(url.url, true);
const isHypixelApi = urlData.host === 'api.hypixel.net';
const isMojangApi = urlData.host === 'playerdb.co';
const isMojangApi = urlData.host === 'ashcon.app';

const target = urllib.format(urlData);

Expand Down

0 comments on commit 75c35d7

Please sign in to comment.