From 20800161a5d70b01a8d9a0345c985c75c5865219 Mon Sep 17 00:00:00 2001
From: mat <github@matdoes.dev>
Date: Tue, 28 Dec 2021 19:06:05 -0600
Subject: fix for removing invalid api key

---
 build/hypixelApi.js | 2 +-
 src/hypixelApi.ts   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/build/hypixelApi.js b/build/hypixelApi.js
index 2377eca..f29471a 100644
--- a/build/hypixelApi.js
+++ b/build/hypixelApi.js
@@ -76,7 +76,7 @@ export let sendApiRequest = async function sendApiRequest({ path, key, args }) {
     if (fetchJsonParsed.cause === 'Invalid API key') {
         apiKeys.splice(apiKeys.indexOf(key), 1);
         console.log(`${key} is invalid, removing it from the list of keys`);
-        return await sendApiRequest({ path, key: null, args });
+        return await sendApiRequest({ path, key: chooseApiKey(), args });
     }
     if (fetchResponse.headers.get('ratelimit-limit'))
         // remember how many uses it has
diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts
index 6939ea2..d39b155 100644
--- a/src/hypixelApi.ts
+++ b/src/hypixelApi.ts
@@ -174,7 +174,7 @@ export let sendApiRequest = async function sendApiRequest({ path, key, args }):
 	if (fetchJsonParsed.cause === 'Invalid API key') {
 		apiKeys.splice(apiKeys.indexOf(key), 1)
 		console.log(`${key} is invalid, removing it from the list of keys`)
-		return await sendApiRequest({ path, key: null, args })
+		return await sendApiRequest({ path, key: chooseApiKey(), args })
 	}
 
 	if (fetchResponse.headers.get('ratelimit-limit'))
-- 
cgit