aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-10 19:41:41 -0500
committermat <github@matdoes.dev>2022-04-10 19:41:41 -0500
commit69f88bee6afd00e0fd40a12398bd06ddbfb213e6 (patch)
tree33390b7372b2629de1a3bf6c463e563ca8c5eeed /src
parentbb51cb468e9944de1647b87066142f559be2926a (diff)
downloadskyblock-api-69f88bee6afd00e0fd40a12398bd06ddbfb213e6.tar.gz
skyblock-api-69f88bee6afd00e0fd40a12398bd06ddbfb213e6.tar.bz2
skyblock-api-69f88bee6afd00e0fd40a12398bd06ddbfb213e6.zip
Fix api key tracker
Diffstat (limited to 'src')
-rw-r--r--src/hypixelApi.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts
index 5f2bfb1..42d4f74 100644
--- a/src/hypixelApi.ts
+++ b/src/hypixelApi.ts
@@ -131,12 +131,12 @@ export let sendApiRequest = async<P extends keyof typedHypixelApi.Requests>(path
}
}
- if ('key' in options && response.headers['RateLimit-Limit']) {
+ if ('key' in options && response.headers['ratelimit-limit']) {
// remember how many uses it has
apiKeyUsage[options.key] = {
- remaining: response.headers['RateLimit-Remaining'] ?? 0,
- limit: response.headers['Ratelimit-Limit'] ?? 0,
- reset: Date.now() + response.headers['Ratelimit-Reset'] ?? 0 * 1000 + 1000,
+ remaining: response.headers['ratelimit-remaining'] ?? 0,
+ limit: response.headers['ratelimit-limit'] ?? 0,
+ reset: Date.now() + response.headers['ratelimit-reset'] ?? 0 * 1000 + 1000,
}
let usage = apiKeyUsage[options.key].limit - apiKeyUsage[options.key].remaining