From cc0b5170fa591dfc0b3c4856d6114893c48d89f7 Mon Sep 17 00:00:00 2001 From: mat-1 Date: Thu, 25 Mar 2021 03:19:10 +0000 Subject: Compiled TS into JS --- build/mojang.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- cgit