From 8c39ee0f01ccad3cfbdc8d36a3dfb189acd1c75f Mon Sep 17 00:00:00 2001 From: mat-1 Date: Fri, 16 Apr 2021 18:14:50 +0000 Subject: Compiled TS into JS --- build/hypixelApi.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/hypixelApi.js b/build/hypixelApi.js index 2b3a601..0656d62 100644 --- a/build/hypixelApi.js +++ b/build/hypixelApi.js @@ -71,7 +71,9 @@ async function sendApiRequest({ path, key, args }) { 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; } -- cgit