aboutsummaryrefslogtreecommitdiff
path: root/build/hypixelApi.js
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-06-29 17:52:00 -0500
committerGitHub <noreply@github.com>2021-06-29 17:52:00 -0500
commitc0c534dafb54ebf9f95a5054f576ad99de29f232 (patch)
tree8a8a81f5bd6fbb372899f769be402f0bec326149 /build/hypixelApi.js
parent6c7d2de36be559f62560f00fc2297c7deec3a051 (diff)
downloadskyblock-api-c0c534dafb54ebf9f95a5054f576ad99de29f232.tar.gz
skyblock-api-c0c534dafb54ebf9f95a5054f576ad99de29f232.tar.bz2
skyblock-api-c0c534dafb54ebf9f95a5054f576ad99de29f232.zip
enable strictNullChecks and fix all related issues (#65)
Diffstat (limited to 'build/hypixelApi.js')
-rw-r--r--build/hypixelApi.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/build/hypixelApi.js b/build/hypixelApi.js
index df6d426..a35dd64 100644
--- a/build/hypixelApi.js
+++ b/build/hypixelApi.js
@@ -60,6 +60,7 @@ exports.getKeyUsage = getKeyUsage;
/** Send an HTTP request to the Hypixel API */
async function sendApiRequest({ path, key, args }) {
// Send a raw http request to api.hypixel.net, and return the parsed json
+ var _a, _b, _c;
if (key)
// If there's an api key, add it to the arguments
args.key = key;
@@ -84,9 +85,9 @@ async function sendApiRequest({ path, key, args }) {
if (fetchResponse.headers.get('ratelimit-limit'))
// remember how many uses it has
apiKeyUsage[key] = {
- remaining: parseInt(fetchResponse.headers.get('ratelimit-remaining')),
- limit: parseInt(fetchResponse.headers.get('ratelimit-limit')),
- reset: Date.now() + parseInt(fetchResponse.headers.get('ratelimit-reset')) * 1000
+ remaining: parseInt((_a = fetchResponse.headers.get('ratelimit-remaining')) !== null && _a !== void 0 ? _a : '0'),
+ limit: parseInt((_b = fetchResponse.headers.get('ratelimit-limit')) !== null && _b !== void 0 ? _b : '0'),
+ reset: Date.now() + parseInt((_c = fetchResponse.headers.get('ratelimit-reset')) !== null && _c !== void 0 ? _c : '0') * 1000
};
if (fetchJsonParsed.throttle) {
if (apiKeyUsage[key])