aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/index.js16
-rw-r--r--build/mojang.js1
2 files changed, 12 insertions, 5 deletions
diff --git a/build/index.js b/build/index.js
index 577c1ac..736b137 100644
--- a/build/index.js
+++ b/build/index.js
@@ -64,11 +64,15 @@ app.get('/', async (req, res) => {
});
app.get('/player/:user', async (req, res) => {
try {
- res.json(await hypixel_1.fetchUser({ user: req.params.user }, [req.query.basic === 'true' ? undefined : 'profiles', 'player'], req.query.customization === 'true'));
+ const user = await hypixel_1.fetchUser({ user: req.params.user }, [req.query.basic === 'true' ? undefined : 'profiles', 'player'], req.query.customization === 'true');
+ if (user)
+ res.json(user);
+ else
+ res.status(404).json({ error: true });
}
catch (err) {
console.error(err);
- res.json({ 'error': true });
+ res.json({ error: true });
}
});
app.get('/discord/:id', async (req, res) => {
@@ -82,11 +86,15 @@ app.get('/discord/:id', async (req, res) => {
});
app.get('/player/:user/:profile', async (req, res) => {
try {
- res.json(await hypixel_1.fetchMemberProfile(req.params.user, req.params.profile, req.query.customization === 'true'));
+ const profile = await hypixel_1.fetchMemberProfile(req.params.user, req.params.profile, req.query.customization === 'true');
+ if (profile)
+ res.json(profile);
+ else
+ res.status(404).json({ error: true });
}
catch (err) {
console.error(err);
- res.json({ 'error': true });
+ res.json({ error: true });
}
});
app.get('/player/:user/:profile/leaderboards', async (req, res) => {
diff --git a/build/mojang.js b/build/mojang.js
index e5b6ee6..3ad8d5e 100644
--- a/build/mojang.js
+++ b/build/mojang.js
@@ -88,7 +88,6 @@ async function profileFromUsernameAlternative(username) {
catch {
return { uuid: null, username: null };
}
- console.log('aight ashcon returned', data);
return {
uuid: util_1.undashUuid(data.uuid),
username: data.username