diff options
-rw-r--r-- | build/hypixelApi.js | 8 | ||||
-rw-r--r-- | src/hypixelApi.ts | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/build/hypixelApi.js b/build/hypixelApi.js index 59a798c..7c1176e 100644 --- a/build/hypixelApi.js +++ b/build/hypixelApi.js @@ -81,12 +81,12 @@ async function sendApiRequest({ path, key, args }) { await new Promise((resolve) => setTimeout(resolve, 30000)); return await sendApiRequest({ path, key, args }); } - if (fetchResponse.headers['ratelimit-limit']) + if (fetchResponse.headers.get('ratelimit-limit')) // remember how many uses it has apiKeyUsage[key] = { - remaining: fetchResponse.headers['ratelimit-remaining'], - limit: fetchResponse.headers['ratelimit-limit'], - reset: Date.now() + parseInt(fetchResponse.headers['ratelimit-reset']) * 1000 + remaining: parseInt(fetchResponse.headers.get('ratelimit-remaining')), + limit: parseInt(fetchResponse.headers.get('ratelimit-limit')), + reset: Date.now() + parseInt(fetchResponse.headers.get('ratelimit-reset')) * 1000 }; if (fetchJsonParsed.throttle) { if (apiKeyUsage[key]) diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts index a212f34..886b261 100644 --- a/src/hypixelApi.ts +++ b/src/hypixelApi.ts @@ -170,12 +170,12 @@ export async function sendApiRequest({ path, key, args }): Promise<HypixelRespon return await sendApiRequest({ path, key, args }) } - if (fetchResponse.headers['ratelimit-limit']) + if (fetchResponse.headers.get('ratelimit-limit')) // remember how many uses it has apiKeyUsage[key] = { - remaining: fetchResponse.headers['ratelimit-remaining'], - limit: fetchResponse.headers['ratelimit-limit'], - reset: Date.now() + parseInt(fetchResponse.headers['ratelimit-reset']) * 1000 + remaining: parseInt(fetchResponse.headers.get('ratelimit-remaining')), + limit: parseInt(fetchResponse.headers.get('ratelimit-limit')), + reset: Date.now() + parseInt(fetchResponse.headers.get('ratelimit-reset')) * 1000 } if (fetchJsonParsed.throttle) { |