aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/achievements.ts
blob: 9e4c7ae4a5bfb6a5398dcffc32376dc768a3fa1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import typedHypixelApi from 'typed-hypixel-api'

export interface Achievements {
	skyblock: Record<string, number>
}

export function cleanPlayerAchievements(data: typedHypixelApi.PlayerDataResponse['player']): Achievements {
	const achievements: Achievements = {
		skyblock: {}
	}

	for (const [id, value] of Object.entries(data.achievements)) {
		if (id.startsWith('skyblock_'))
			achievements.skyblock[id.substring(9)] = value
	}

	return achievements
}