diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-16 14:11:00 -0500 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-16 14:11:00 -0500 |
commit | aa9ebf76317c579361ed3f6290558179cd266a31 (patch) | |
tree | 338b9df1f619fc98c55aa656154a2836ffcfc5ff /src | |
parent | 37a012efa0aea75b7753ab58bfa3d8489ee4aa61 (diff) | |
download | skyblock-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.ts | 6 |
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] = { |