aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cleaners/skyblock/claimed.ts2
-rw-r--r--src/database.ts4
-rw-r--r--src/hypixel.ts2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/cleaners/skyblock/claimed.ts b/src/cleaners/skyblock/claimed.ts
index f30dedf..0873af9 100644
--- a/src/cleaners/skyblock/claimed.ts
+++ b/src/cleaners/skyblock/claimed.ts
@@ -18,7 +18,7 @@ export function cleanPlayerSkyblockClaimed(data: typedHypixelApi.PlayerDataRespo
const centuryCakes = Object.keys(data).filter((key) => key.startsWith('claimed_century_cake'))
for (const centuryCake of centuryCakes) {
- const centuryCakeYear = centuryCake === 'claimed_century_cake' ? '100' : centuryCakes.slice('claimed_century_cake'.length)
+ const centuryCakeYear = centuryCake === 'claimed_century_cake' ? '100' : centuryCake.slice('claimed_century_cake'.length)
claimedItems.push({
name: `year_${centuryCakeYear}_century_cake`,
timestamp: data[centuryCake]
diff --git a/src/database.ts b/src/database.ts
index fa4cbd2..9e29328 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -934,7 +934,7 @@ async function removeBadMemberLeaderboardAttributes(): Promise<void> {
export let finishedCachingRawLeaderboards = false
/** Fetch all the leaderboards, used for caching. Don't call this often! */
-async function fetchAllLeaderboards(fast?: boolean): Promise<void> {
+async function fetchAllLeaderboards(): Promise<void> {
const leaderboards: string[] = await fetchAllMemberLeaderboardAttributes()
if (debug) console.debug('Caching raw leaderboards!')
@@ -1006,7 +1006,7 @@ if (!globalThis.isTest) {
// when it connects, cache the leaderboards and remove bad members
removeBadMemberLeaderboardAttributes()
// cache leaderboards on startup so its faster later on
- fetchAllLeaderboards(true)
+ fetchAllLeaderboards()
// cache leaderboard players again every 4 hours
setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000)
})
diff --git a/src/hypixel.ts b/src/hypixel.ts
index 549f593..d01e699 100644
--- a/src/hypixel.ts
+++ b/src/hypixel.ts
@@ -50,6 +50,8 @@ export interface ApiOptions {
export async function sendCleanApiRequest<P extends keyof typeof cleanResponseFunctions>(path: P, args: Omit<typedHypixelApi.Requests[P]['options'], 'key'>, options?: ApiOptions): Promise<Awaited<ReturnType<typeof cleanResponseFunctions[P]>>> {
const key = await chooseApiKey()
const data = await sendApiRequest(path, { key, ...args })
+ if (!data)
+ throw new Error(`No data returned from ${path}`)
// clean the response
return await cleanResponse(path, data, options ?? {})
}