diff options
author | mat-1 <github@matdoes.dev> | 2021-03-25 03:19:10 +0000 |
---|---|---|
committer | mat-1 <github@matdoes.dev> | 2021-03-25 03:19:10 +0000 |
commit | cc0b5170fa591dfc0b3c4856d6114893c48d89f7 (patch) | |
tree | 30d2940ae8d43cdb9db89d73b5a3224c246a2a06 /build/mojang.js | |
parent | 1708632ee4746e116a21c546943381cce50ddc43 (diff) | |
download | skyblock-api-cc0b5170fa591dfc0b3c4856d6114893c48d89f7.tar.gz skyblock-api-cc0b5170fa591dfc0b3c4856d6114893c48d89f7.tar.bz2 skyblock-api-cc0b5170fa591dfc0b3c4856d6114893c48d89f7.zip |
Compiled TS into JS
Diffstat (limited to 'build/mojang.js')
-rw-r--r-- | build/mojang.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/build/mojang.js b/build/mojang.js index 2348a0a..ae0e1e6 100644 --- a/build/mojang.js +++ b/build/mojang.js @@ -21,7 +21,17 @@ async function mojangDataFromUuid(uuid) { const fetchResponse = await node_fetch_1.default( // using mojang directly is faster than ashcon lol, also mojang removed the ratelimits from here `https://sessionserver.mojang.com/session/minecraft/profile/${util_1.undashUuid(uuid)}`, { agent: () => httpsAgent }); - const data = await fetchResponse.json(); + let data; + try { + data = await fetchResponse.json(); + } + catch { + // if it errors, just return null + return { + uuid: null, + username: null + }; + } return { uuid: data.id, username: data.name |