aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-12-28 19:44:22 -0600
committermat <github@matdoes.dev>2021-12-28 19:44:22 -0600
commit07d92497a362e9a15f6319c9b73b1280d6f39c87 (patch)
treecddf4d19ca12b27566f6f5ff751776235a6712de /build
parent3703a3b53efae8e1f3de0029f2d1d5499fdc0fdd (diff)
downloadskyblock-api-07d92497a362e9a15f6319c9b73b1280d6f39c87.tar.gz
skyblock-api-07d92497a362e9a15f6319c9b73b1280d6f39c87.tar.bz2
skyblock-api-07d92497a362e9a15f6319c9b73b1280d6f39c87.zip
don't remove multiple times
Diffstat (limited to 'build')
-rw-r--r--build/hypixelApi.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/build/hypixelApi.js b/build/hypixelApi.js
index 35c3119..ae647b7 100644
--- a/build/hypixelApi.js
+++ b/build/hypixelApi.js
@@ -75,8 +75,10 @@ export let sendApiRequest = async function sendApiRequest({ path, key, args }) {
}
// if the cause is "Invalid API key", remove the key from the list of keys and try again
if (fetchJsonParsed.cause === 'Invalid API key') {
- apiKeys.splice(apiKeys.indexOf(key), 1);
- console.log(`${key} is invalid, removing it from the list of keys`);
+ if (apiKeys.includes(key)) {
+ apiKeys.splice(apiKeys.indexOf(key), 1);
+ console.log(`${key} is invalid, removing it from the list of keys`);
+ }
return await sendApiRequest({ path, key: chooseApiKey(), args });
}
if (fetchResponse.headers.get('ratelimit-limit'))