From 3703a3b53efae8e1f3de0029f2d1d5499fdc0fdd Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 28 Dec 2021 19:32:10 -0600 Subject: fix issue with api key --- build/hypixelApi.js | 3 ++- src/hypixelApi.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build/hypixelApi.js b/build/hypixelApi.js index f29471a..35c3119 100644 --- a/build/hypixelApi.js +++ b/build/hypixelApi.js @@ -20,7 +20,8 @@ export function chooseApiKey() { // find the api key with the lowest amount of uses let bestKeyUsage = null; let bestKey = null; - for (let key of shuffle(apiKeys.slice())) { + // we limit to 5 api keys because otherwise they get automatically banned + for (let key of shuffle(apiKeys.slice(0, 5))) { const keyUsage = apiKeyUsage[key]; // if the key has never been used before, use it if (!keyUsage) diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts index d39b155..9a0a6da 100644 --- a/src/hypixelApi.ts +++ b/src/hypixelApi.ts @@ -36,7 +36,8 @@ export function chooseApiKey(): string | null { // find the api key with the lowest amount of uses let bestKeyUsage: KeyUsage | null = null let bestKey: string | null = null - for (let key of shuffle(apiKeys.slice())) { + // we limit to 5 api keys because otherwise they get automatically banned + for (let key of shuffle(apiKeys.slice(0, 5))) { const keyUsage = apiKeyUsage[key] // if the key has never been used before, use it -- cgit