diff options
author | mat <github@matdoes.dev> | 2022-05-27 13:42:38 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-05-27 13:42:38 -0500 |
commit | 445d2929970e583cd1b7331d6a86015b0cf25777 (patch) | |
tree | 056eadf870e5bfeff4f0a1122e50218f2336bb5c /src/cleaners | |
parent | d85e645d903c48fee0b5593400f23f69c1b2786a (diff) | |
download | skyblock-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.ts | 4 |
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)) { |