aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-27 13:42:38 -0500
committermat <github@matdoes.dev>2022-05-27 13:42:38 -0500
commit445d2929970e583cd1b7331d6a86015b0cf25777 (patch)
tree056eadf870e5bfeff4f0a1122e50218f2336bb5c /src/cleaners
parentd85e645d903c48fee0b5593400f23f69c1b2786a (diff)
downloadskyblock-api-445d2929970e583cd1b7331d6a86015b0cf25777.tar.gz
skyblock-api-445d2929970e583cd1b7331d6a86015b0cf25777.tar.bz2
skyblock-api-445d2929970e583cd1b7331d6a86015b0cf25777.zip
Handle players with no/hidden achievements
Diffstat (limited to 'src/cleaners')
-rw-r--r--src/cleaners/achievements.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cleaners/achievements.ts b/src/cleaners/achievements.ts
index beedaf9..edb4d07 100644
--- a/src/cleaners/achievements.ts
+++ b/src/cleaners/achievements.ts
@@ -27,6 +27,10 @@ export interface Achievements {
}
export async function cleanPlayerAchievements(data: typedHypixelApi.PlayerDataResponse['player']): Promise<Achievements> {
+ if (!data.achievements) {
+ return { tiered: [], challenge: [] }
+ }
+
const gameAchievements: typedHypixelApi.AchievementsResponse['achievements'] = await fetchAchievements()
for (const [gameId, achievementsData] of Object.entries(gameAchievements)) {