aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/achievements.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/cleaners/achievements.ts')
-rw-r--r--src/cleaners/achievements.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/cleaners/achievements.ts b/src/cleaners/achievements.ts
new file mode 100644
index 0000000..9e4c7ae
--- /dev/null
+++ b/src/cleaners/achievements.ts
@@ -0,0 +1,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
+}