aboutsummaryrefslogtreecommitdiff
path: root/src/database.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-20 19:16:16 -0500
committermat <github@matdoes.dev>2022-04-20 19:16:16 -0500
commit6b2bdd5b86eb0ebdf67b50bf5f2dcf74044fe914 (patch)
tree986d1f11c1267d9598a15f6031aeee1e2925ea63 /src/database.ts
parent5712e10eec2c9fa881bdf19295808404c56f7d33 (diff)
downloadskyblock-api-6b2bdd5b86eb0ebdf67b50bf5f2dcf74044fe914.tar.gz
skyblock-api-6b2bdd5b86eb0ebdf67b50bf5f2dcf74044fe914.tar.bz2
skyblock-api-6b2bdd5b86eb0ebdf67b50bf5f2dcf74044fe914.zip
store api ids in skyblock-constants
Diffstat (limited to 'src/database.ts')
-rw-r--r--src/database.ts9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/database.ts b/src/database.ts
index 93e2a40..8b606d4 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -16,6 +16,7 @@ import { v4 as uuid4 } from 'uuid'
import { debug } from './index.js'
import Queue from 'queue-promise'
import { RANK_COLORS } from './cleaners/rank.js'
+import { cleanItemId } from './cleaners/skyblock/itemId.js'
// don't update the user for 3 minutes
const recentlyUpdated = new NodeCache({
@@ -357,7 +358,7 @@ export async function fetchAllMemberLeaderboardAttributes(): Promise<string[]> {
...await constants.fetchStats(),
// collection leaderboards
- ...(await constants.fetchCollections()).map(value => `collection_${value}`),
+ ...(await constants.fetchCollections()).map(value => `collection_${cleanItemId(value)}`),
// skill leaderboards
...(await constants.fetchSkills()).map(value => `skill_${value}`),
@@ -811,12 +812,6 @@ export async function updateDatabaseMember(member: CleanMember, profile: CleanFu
if (member.rawHypixelStats)
constants.addStats(Object.keys(member.rawHypixelStats))
- constants.addCollections(member.collections.map(coll => coll.name))
- constants.addSkills(member.skills.map(skill => skill.name))
- constants.addZones(member.zones.map(zone => zone.name))
- constants.addSlayers(member.slayers.bosses.map(s => s.rawName))
- constants.addPets(member.pets.list.map(s => s.id))
- constants.addHarpSongs(member.harp.songs.map(s => s.id))
if (debug) console.debug('done constants..')