diff options
-rw-r--r-- | build/cleaners/player.js | 2 | ||||
-rw-r--r-- | build/cleaners/skyblock/member.js | 2 | ||||
-rw-r--r-- | build/cleaners/skyblock/profile.js | 2 | ||||
-rw-r--r-- | build/cleaners/skyblock/stats.js | 3 | ||||
-rw-r--r-- | build/hypixelCached.js | 2 |
5 files changed, 9 insertions, 2 deletions
diff --git a/build/cleaners/player.js b/build/cleaners/player.js index a767d7e..4957e7a 100644 --- a/build/cleaners/player.js +++ b/build/cleaners/player.js @@ -8,6 +8,8 @@ const util_1 = require("../util"); async function cleanPlayerResponse(data) { var _a, _b; // Cleans up a 'player' api response + if (!data) + return; // bruh return { uuid: util_1.undashUuid(data.uuid), username: data.displayname, diff --git a/build/cleaners/skyblock/member.js b/build/cleaners/skyblock/member.js index 2e07f39..5c26e40 100644 --- a/build/cleaners/skyblock/member.js +++ b/build/cleaners/skyblock/member.js @@ -47,6 +47,8 @@ async function cleanSkyBlockProfileMemberResponse(member, included = null) { // profiles.members[] const inventoriesIncluded = included == null || included.includes('inventories'); const player = await cached.fetchPlayer(member.uuid); + if (!player) + return; return { uuid: member.uuid, username: player.username, diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js index 3a6bc6f..ef90ce8 100644 --- a/build/cleaners/skyblock/profile.js +++ b/build/cleaners/skyblock/profile.js @@ -33,7 +33,7 @@ async function cleanSkyblockProfileResponse(data, options) { memberRaw.uuid = memberUUID; promises.push(member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats', (options === null || options === void 0 ? void 0 : options.mainMemberUuid) === memberUUID ? 'inventories' : undefined])); } - const cleanedMembers = await Promise.all(promises); + const cleanedMembers = (await Promise.all(promises)).filter(m => m !== null && m !== undefined); const memberMinions = []; for (const member of cleanedMembers) { memberMinions.push(member.minions); diff --git a/build/cleaners/skyblock/stats.js b/build/cleaners/skyblock/stats.js index d805683..d7aa984 100644 --- a/build/cleaners/skyblock/stats.js +++ b/build/cleaners/skyblock/stats.js @@ -4,10 +4,11 @@ exports.cleanProfileStats = exports.categorizeStat = void 0; const statCategories = { 'deaths': ['deaths_', 'deaths'], 'kills': ['kills_', 'kills'], - 'fishing': ['items_fished_', 'items_fished'], + 'fishing': ['items_fished_', 'items_fished', 'shredder_'], 'auctions': ['auctions_'], 'collection': ['collection_'], 'races': ['_best_time', '_best_time_2'], + 'mythos': ['mythos_burrows_', 'mythos_kills'], 'misc': null // everything else goes here }; function categorizeStat(statNameRaw) { diff --git a/build/hypixelCached.js b/build/hypixelCached.js index 880d0fb..c4a3743 100644 --- a/build/hypixelCached.js +++ b/build/hypixelCached.js @@ -137,6 +137,8 @@ async function fetchPlayer(user) { path: 'player', args: { uuid: playerUuid } }); + if (!cleanPlayer) + return; // clone in case it gets modified somehow later const cleanPlayerClone = Object.assign({}, cleanPlayer); playerCache.set(playerUuid, cleanPlayerClone); |