aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-04-16 14:11:00 -0500
committermat <27899617+mat-1@users.noreply.github.com>2021-04-16 14:11:00 -0500
commitaa9ebf76317c579361ed3f6290558179cd266a31 (patch)
tree338b9df1f619fc98c55aa656154a2836ffcfc5ff /src
parent37a012efa0aea75b7753ab58bfa3d8489ee4aa61 (diff)
downloadskyblock-api-aa9ebf76317c579361ed3f6290558179cd266a31.tar.gz
skyblock-api-aa9ebf76317c579361ed3f6290558179cd266a31.tar.bz2
skyblock-api-aa9ebf76317c579361ed3f6290558179cd266a31.zip
wait 30 seconds and retry on endpoint disabled
Diffstat (limited to 'src')
-rw-r--r--src/hypixelApi.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts
index ee63155..f4c9817 100644
--- a/src/hypixelApi.ts
+++ b/src/hypixelApi.ts
@@ -151,6 +151,12 @@ export async function sendApiRequest({ path, key, args }): Promise<HypixelRespon
return await sendApiRequest({ path, key, args })
}
+ // bruh
+ if (fetchJsonParsed.cause === 'This endpoint is currently disabled') {
+ await new Promise((resolve) => setTimeout(resolve, 30000))
+ return await sendApiRequest({ path, key, args })
+ }
+
if (fetchResponse.headers['ratelimit-limit'])
// remember how many uses it has
apiKeyUsage[key] = {