diff options
Diffstat (limited to 'src/hypixelApi.ts')
-rw-r--r-- | src/hypixelApi.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts index 9840c79..f072d11 100644 --- a/src/hypixelApi.ts +++ b/src/hypixelApi.ts @@ -161,7 +161,9 @@ export async function sendApiRequest({ path, key, args }): Promise<HypixelRespon if (fetchJsonParsed.throttle) { if (apiKeyUsage[key]) apiKeyUsage[key].remaining = 0 - return { throttled: true } + // if it's throttled, wait 10 seconds and try again + await new Promise((resolve) => setTimeout(resolve, 10000)) + return await sendApiRequest({ path, key, args }) } return fetchJsonParsed } |