From 81539e1a7a808f106cff9388dc3256f1af9e3b86 Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 26 Aug 2024 15:07:12 +0800 Subject: [PATCH] better testing --- src/API/getAchievements.test.ts | 4 ++-- src/API/getActiveHouses.test.ts | 4 ++-- src/API/getBoosters.test.ts | 4 ++-- src/API/getChallenges.test.ts | 4 ++-- src/API/getGameCounts.test.ts | 4 ++-- src/API/getGuild.test.ts | 18 +++++++++--------- src/API/getGuildAchievements.test.ts | 4 ++-- src/API/getHouse.test.ts | 6 +++--- src/API/getLeaderboards.test.ts | 4 ++-- src/API/getPlayer.test.ts | 14 +++++++------- src/API/getPlayerHouses.test.ts | 6 +++--- src/API/getQuests.test.ts | 4 ++-- src/API/getRecentGames.test.ts | 6 +++--- src/API/getSkyblockAuction.test.ts | 12 ++++++------ src/API/getSkyblockAuctions.test.ts | 16 ++++++++-------- src/API/getSkyblockAuctionsByPlayer.test.ts | 8 ++++---- src/API/getSkyblockBazaar.test.ts | 4 ++-- src/API/getSkyblockBingo.test.ts | 4 ++-- src/API/getSkyblockFireSales.test.ts | 4 ++-- src/API/getSkyblockGarden.test.ts | 6 +++--- src/API/getSkyblockGovernment.test.ts | 4 ++-- src/API/getSkyblockMember.test.ts | 8 ++++---- src/API/getSkyblockMuseum.test.ts | 6 +++--- src/API/getSkyblockNews.test.ts | 4 ++-- src/API/getSkyblockProfiles.test.ts | 12 ++++++------ src/API/getStatus.test.ts | 4 ++-- src/API/getWatchdogStats.test.ts | 4 ++-- src/Private/RateLimit.ts | 1 + src/Private/Requests.ts | 9 ++++++--- src/Private/Updater.ts | 2 +- 30 files changed, 97 insertions(+), 93 deletions(-) diff --git a/src/API/getAchievements.test.ts b/src/API/getAchievements.test.ts index 077cf8a4..ec8d2f95 100644 --- a/src/API/getAchievements.test.ts +++ b/src/API/getAchievements.test.ts @@ -7,7 +7,7 @@ import { StaticGameNames } from '../typings'; import Client from '../Client'; test('getAchievements (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getAchievements({ raw: true }); @@ -17,7 +17,7 @@ test('getAchievements (raw)', async () => { }); test('getAchievements', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getAchievements(); diff --git a/src/API/getActiveHouses.test.ts b/src/API/getActiveHouses.test.ts index 9df2d837..e96261c5 100644 --- a/src/API/getActiveHouses.test.ts +++ b/src/API/getActiveHouses.test.ts @@ -3,7 +3,7 @@ import House from '../structures/House'; import Client from '../Client'; test('getActiveHouses (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getActiveHouses({ raw: true }); @@ -13,7 +13,7 @@ test('getActiveHouses (raw)', async () => { }); test('getActiveHouses', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getActiveHouses(); diff --git a/src/API/getBoosters.test.ts b/src/API/getBoosters.test.ts index d4cd5680..dc9783b9 100644 --- a/src/API/getBoosters.test.ts +++ b/src/API/getBoosters.test.ts @@ -4,7 +4,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getBoosters (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getBoosters({ raw: true }); @@ -14,7 +14,7 @@ test('getBoosters (raw)', async () => { }); test('getBoosters', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getBoosters(); diff --git a/src/API/getChallenges.test.ts b/src/API/getChallenges.test.ts index bf9bc768..d6657e39 100644 --- a/src/API/getChallenges.test.ts +++ b/src/API/getChallenges.test.ts @@ -5,7 +5,7 @@ import { StaticGameNames } from '../typings'; import Client from '../Client'; test('getChallenges (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getChallenges({ raw: true }); @@ -15,7 +15,7 @@ test('getChallenges (raw)', async () => { }); test('getChallenges', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getChallenges(); diff --git a/src/API/getGameCounts.test.ts b/src/API/getGameCounts.test.ts index 65fa4eab..4ab1e958 100644 --- a/src/API/getGameCounts.test.ts +++ b/src/API/getGameCounts.test.ts @@ -3,7 +3,7 @@ import GameCounts from '../structures/GameCounts'; import Client from '../Client'; test('getGameCounts (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGameCounts({ raw: true }); @@ -13,7 +13,7 @@ test('getGameCounts (raw)', async () => { }); test('getGameCounts', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGameCounts(); diff --git a/src/API/getGuild.test.ts b/src/API/getGuild.test.ts index bc52a3ad..25826c07 100644 --- a/src/API/getGuild.test.ts +++ b/src/API/getGuild.test.ts @@ -8,7 +8,7 @@ import { ExpHistory } from '../utils/Guild'; import Client from '../Client'; test('Invalid Guild Type', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getGuild('invalid', 'invalid')).rejects.toThrowError( @@ -18,7 +18,7 @@ test('Invalid Guild Type', () => { }); test('Invalid Guild', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getGuild('name', 'this guild dose not exist')).rejects.toThrowError( @@ -28,7 +28,7 @@ test('Invalid Guild', () => { }); test('Invalid Guild ID', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getGuild('id', 'invalid guild id')).rejects.toThrowError(client.errors.INVALID_GUILD_ID); @@ -36,7 +36,7 @@ test('Invalid Guild ID', () => { }); test('No Guild Query', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getGuild('id')).rejects.toThrowError(client.errors.NO_GUILD_QUERY); @@ -44,7 +44,7 @@ test('No Guild Query', () => { }); test('User not in a guild', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGuild('player', '37501e7512b845ab8796e2baf9e9677a'); @@ -54,7 +54,7 @@ test('User not in a guild', async () => { }); test('getGuild (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGuild('name', 'Pixelic', { raw: true }); @@ -64,7 +64,7 @@ test('getGuild (raw)', async () => { }); test('getGuild (Name)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGuild('name', 'Pixelic'); @@ -247,7 +247,7 @@ test('getGuild (Name)', async () => { }); test('getGuild (Id)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGuild('id', '64b54f9d8ea8c96aaedafe84'); @@ -385,7 +385,7 @@ test('getGuild (Id)', async () => { }); test('getGuild (Player)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGuild('player', '14727faefbdc4aff848cd2713eb9939e'); diff --git a/src/API/getGuildAchievements.test.ts b/src/API/getGuildAchievements.test.ts index 750dafca..f4ee82b9 100644 --- a/src/API/getGuildAchievements.test.ts +++ b/src/API/getGuildAchievements.test.ts @@ -5,7 +5,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getGuildAchievements (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGuildAchievements({ raw: true }); @@ -15,7 +15,7 @@ test('getGuildAchievements (raw)', async () => { }); test('getGuildAchievements', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getGuildAchievements(); diff --git a/src/API/getHouse.test.ts b/src/API/getHouse.test.ts index 05a19857..58cc6d6c 100644 --- a/src/API/getHouse.test.ts +++ b/src/API/getHouse.test.ts @@ -3,7 +3,7 @@ import House from '../structures/House'; import Client from '../Client'; test('getHouse (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const houses = await client.getActiveHouses(); @@ -16,7 +16,7 @@ test('getHouse (raw)', async () => { }); test('getHouse (no input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getHouse()).rejects.toThrowError(client.errors.NO_UUID); @@ -24,7 +24,7 @@ test('getHouse (no input)', () => { }); test('getHouse', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const houses = await client.getActiveHouses(); diff --git a/src/API/getLeaderboards.test.ts b/src/API/getLeaderboards.test.ts index c82f22d7..1f197426 100644 --- a/src/API/getLeaderboards.test.ts +++ b/src/API/getLeaderboards.test.ts @@ -4,7 +4,7 @@ import Client from '../Client'; import axios from 'axios'; test('getLeaderboards (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getLeaderboards({ raw: true }); @@ -14,7 +14,7 @@ test('getLeaderboards (raw)', async () => { }); test('getLeaderboards', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getLeaderboards(); diff --git a/src/API/getPlayer.test.ts b/src/API/getPlayer.test.ts index b9660e3c..39e597b0 100644 --- a/src/API/getPlayer.test.ts +++ b/src/API/getPlayer.test.ts @@ -33,7 +33,7 @@ import PlayerCosmetics from '../structures/PlayerCosmetics'; import RecentGame from '../structures/RecentGame'; test('getPlayer (never joinned hypixel)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); vi.spyOn(axios, 'get').mockResolvedValue({ status: 200, data: { success: true } }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error @@ -45,7 +45,7 @@ test('getPlayer (never joinned hypixel)', async () => { }); test('getPlayer (no input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getPlayer()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID); @@ -53,7 +53,7 @@ test('getPlayer (no input)', () => { }); test('getPLayer (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e', { raw: true }); @@ -63,7 +63,7 @@ test('getPLayer (raw)', async () => { }); test('getPlayer (guild)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e', { guild: true }); @@ -76,7 +76,7 @@ test('getPlayer (guild)', async () => { }); test('getPlayer (houses)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e', { houses: true }); @@ -93,7 +93,7 @@ test('getPlayer (houses)', async () => { }); test('getPlayer (recent games)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e', { recentGames: true }); @@ -110,7 +110,7 @@ test('getPlayer (recent games)', async () => { }); test('getPlayer', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e'); diff --git a/src/API/getPlayerHouses.test.ts b/src/API/getPlayerHouses.test.ts index 238bd5a6..b38e8b21 100644 --- a/src/API/getPlayerHouses.test.ts +++ b/src/API/getPlayerHouses.test.ts @@ -3,7 +3,7 @@ import House from '../structures/House'; import Client from '../Client'; test('getPlayerHouses (No input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getPlayerHouses()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID); @@ -11,7 +11,7 @@ test('getPlayerHouses (No input)', () => { }); test('getPlayerHouses (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getPlayerHouses('69e04609da2a4e7dabb83546a971969e', { raw: true }); @@ -21,7 +21,7 @@ test('getPlayerHouses (raw)', async () => { }); test('getPlayerHouses', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getPlayerHouses('69e04609da2a4e7dabb83546a971969e'); diff --git a/src/API/getQuests.test.ts b/src/API/getQuests.test.ts index 4fe505b8..4109d28c 100644 --- a/src/API/getQuests.test.ts +++ b/src/API/getQuests.test.ts @@ -6,7 +6,7 @@ import { StaticGameNames } from '../typings'; import Client from '../Client'; test('getQuests (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getQuests({ raw: true }); @@ -16,7 +16,7 @@ test('getQuests (raw)', async () => { }); test('getQuests', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getQuests(); diff --git a/src/API/getRecentGames.test.ts b/src/API/getRecentGames.test.ts index 5a0de3d4..e8dca548 100644 --- a/src/API/getRecentGames.test.ts +++ b/src/API/getRecentGames.test.ts @@ -4,7 +4,7 @@ import Client from '../Client'; import Game from '../structures/Game'; test('getRecentGames (no input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getRecentGames()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID); @@ -12,7 +12,7 @@ test('getRecentGames (no input)', () => { }); test('getRecentGames (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getRecentGames('14727faefbdc4aff848cd2713eb9939e', { raw: true }); @@ -22,7 +22,7 @@ test('getRecentGames (raw)', async () => { }); test('getRecentGames', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getRecentGames('14727faefbdc4aff848cd2713eb9939e'); diff --git a/src/API/getSkyblockAuction.test.ts b/src/API/getSkyblockAuction.test.ts index c83324fc..1f96e305 100644 --- a/src/API/getSkyblockAuction.test.ts +++ b/src/API/getSkyblockAuction.test.ts @@ -6,7 +6,7 @@ import ItemBytes from '../structures/ItemBytes'; import Client from '../Client'; test('getSkyblockAuction (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const auctions = await client.getSkyblockAuctions(1); @@ -19,7 +19,7 @@ test('getSkyblockAuction (raw)', async () => { }); test('getSkyblockAuction (No Query)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockAuction('player')).rejects.toThrowError(client.errors.NO_NICKNAME_UUID); @@ -27,7 +27,7 @@ test('getSkyblockAuction (No Query)', () => { }); test('getSkyblockAuction (Bad Filter)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockAuction('meow')).rejects.toThrowError(client.errors.BAD_AUCTION_FILTER); @@ -35,7 +35,7 @@ test('getSkyblockAuction (Bad Filter)', () => { }); test('getSkyblockAuction (Auction)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const auctions = await client.getSkyblockAuctions(1); @@ -131,7 +131,7 @@ test('getSkyblockAuction (Auction)', async () => { }); test('getSkyblockAuction (Player)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const auctions = await client.getSkyblockAuctions(1); @@ -227,7 +227,7 @@ test('getSkyblockAuction (Player)', async () => { }); test('getSkyblockAuction (Profile)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const auctions = await client.getSkyblockAuctions(1); diff --git a/src/API/getSkyblockAuctions.test.ts b/src/API/getSkyblockAuctions.test.ts index bbdc622f..5ed6d714 100644 --- a/src/API/getSkyblockAuctions.test.ts +++ b/src/API/getSkyblockAuctions.test.ts @@ -7,7 +7,7 @@ import ItemBytes from '../structures/ItemBytes'; import Client from '../Client'; test('getSkyblockAuctions (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockAuctions(1, { raw: true }); @@ -17,7 +17,7 @@ test('getSkyblockAuctions (raw)', async () => { }); test('getSkyblockAuctions (No input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockAuctions()).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE); @@ -25,7 +25,7 @@ test('getSkyblockAuctions (No input)', () => { }); test('getSkyblockAuctions (Negative Input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockAuctions(-1)).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE); @@ -33,7 +33,7 @@ test('getSkyblockAuctions (Negative Input)', () => { }); test('getSkyblockAuctions (Page 0)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockAuctions(0)).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE); @@ -41,7 +41,7 @@ test('getSkyblockAuctions (Page 0)', () => { }); test('getSkyblockAuctions (String Input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockAuctions('hi')).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE); @@ -49,7 +49,7 @@ test('getSkyblockAuctions (String Input)', () => { }); test('getSkyblockAuctions (One Page)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockAuctions(1); @@ -158,7 +158,7 @@ test('getSkyblockAuctions (One Page)', async () => { }); test('getSkyblockAuctions (One Page Include Item Bytes)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockAuctions(1, { includeItemBytes: true }); @@ -267,7 +267,7 @@ test('getSkyblockAuctions (One Page Include Item Bytes)', async () => { }); test('getSkyblockAuctions (All Pages)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockAuctions('*'); diff --git a/src/API/getSkyblockAuctionsByPlayer.test.ts b/src/API/getSkyblockAuctionsByPlayer.test.ts index 77a313c4..1601d67f 100644 --- a/src/API/getSkyblockAuctionsByPlayer.test.ts +++ b/src/API/getSkyblockAuctionsByPlayer.test.ts @@ -6,7 +6,7 @@ import ItemBytes from '../structures/ItemBytes'; import Client from '../Client'; test('getSkyblockAuctionsByPlayer (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const auctions = await client.getSkyblockAuctions(1); @@ -19,7 +19,7 @@ test('getSkyblockAuctionsByPlayer (raw)', async () => { }); test('getSkyblockAuctionsByPlayer (No Input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockAuctionsByPlayer()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID); @@ -27,7 +27,7 @@ test('getSkyblockAuctionsByPlayer (No Input)', () => { }); test('getSkyblockAuctionsByPlayer', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const auctions = await client.getSkyblockAuctions(1); @@ -148,7 +148,7 @@ test('getSkyblockAuctionsByPlayer', async () => { }); test('getSkyblockAuctionsByPlayer (Item Bytes)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const auctions = await client.getSkyblockAuctions(1); diff --git a/src/API/getSkyblockBazaar.test.ts b/src/API/getSkyblockBazaar.test.ts index 1aad4ff3..230ce1ce 100644 --- a/src/API/getSkyblockBazaar.test.ts +++ b/src/API/getSkyblockBazaar.test.ts @@ -4,7 +4,7 @@ import Order from '../structures/SkyBlock/Bazzar/Order'; import Client from '../Client'; test('getSkyblockBazarr (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockBazaar({ raw: true }); @@ -13,7 +13,7 @@ test('getSkyblockBazarr (raw)', async () => { client.destroy(); }); test('getSkyblockBazarr', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockBazaar(); diff --git a/src/API/getSkyblockBingo.test.ts b/src/API/getSkyblockBingo.test.ts index cfdc96ec..c1ed49d4 100644 --- a/src/API/getSkyblockBingo.test.ts +++ b/src/API/getSkyblockBingo.test.ts @@ -4,7 +4,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getSkyblockBingo (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockBingo({ raw: true }); @@ -14,7 +14,7 @@ test('getSkyblockBingo (raw)', async () => { }); test('getSkyblockBingo', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockBingo(); diff --git a/src/API/getSkyblockFireSales.test.ts b/src/API/getSkyblockFireSales.test.ts index 1e02876f..4aef127e 100644 --- a/src/API/getSkyblockFireSales.test.ts +++ b/src/API/getSkyblockFireSales.test.ts @@ -3,7 +3,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getSkyblockFireSales (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockFireSales({ raw: true }); @@ -13,7 +13,7 @@ test('getSkyblockFireSales (raw)', async () => { }); test('getSkyblockFireSales', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockFireSales(); diff --git a/src/API/getSkyblockGarden.test.ts b/src/API/getSkyblockGarden.test.ts index da1e45cc..b4ce9b54 100644 --- a/src/API/getSkyblockGarden.test.ts +++ b/src/API/getSkyblockGarden.test.ts @@ -9,7 +9,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getSkyblockGarden (no input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockGarden()).rejects.toThrowError(client.errors.NO_UUID); @@ -17,7 +17,7 @@ test('getSkyblockGarden (no input)', () => { }); test('getSkyblockGarden (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockGarden('805c9751-0ff1-4cb6-8e9c-1067bf3bc601', { raw: true }); @@ -27,7 +27,7 @@ test('getSkyblockGarden (raw)', async () => { }); test('getSkyblockGarden', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockGarden('805c9751-0ff1-4cb6-8e9c-1067bf3bc601'); diff --git a/src/API/getSkyblockGovernment.test.ts b/src/API/getSkyblockGovernment.test.ts index f6ff9d2d..bc262be9 100644 --- a/src/API/getSkyblockGovernment.test.ts +++ b/src/API/getSkyblockGovernment.test.ts @@ -5,7 +5,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getSkyblockGovernment (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockGovernment({ raw: true }); @@ -15,7 +15,7 @@ test('getSkyblockGovernment (raw)', async () => { }); test('getSkyblockGovernment', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockGovernment(); diff --git a/src/API/getSkyblockMember.test.ts b/src/API/getSkyblockMember.test.ts index 2f372d63..45ec03f8 100644 --- a/src/API/getSkyblockMember.test.ts +++ b/src/API/getSkyblockMember.test.ts @@ -20,7 +20,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getSkyblockMember (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockMember('14727faefbdc4aff848cd2713eb9939e', { raw: true }); @@ -30,7 +30,7 @@ test('getSkyblockMember (raw)', async () => { }); test('getSkyblockMember (no input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockMember()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID); @@ -38,7 +38,7 @@ test('getSkyblockMember (no input)', () => { }); test('getSkyblockMember (no profiles)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockMember('b45add7b081443909fb00aa9a3e15eb0')).rejects.toThrowError( @@ -48,7 +48,7 @@ test('getSkyblockMember (no profiles)', () => { }); test('getSkyblockMember', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockMember('14727faefbdc4aff848cd2713eb9939e'); diff --git a/src/API/getSkyblockMuseum.test.ts b/src/API/getSkyblockMuseum.test.ts index 9d7651e6..0674e9e5 100644 --- a/src/API/getSkyblockMuseum.test.ts +++ b/src/API/getSkyblockMuseum.test.ts @@ -6,7 +6,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getSkyblockMuseum (no input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockMuseum()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID); @@ -14,7 +14,7 @@ test('getSkyblockMuseum (no input)', () => { }); test('getSkyblockMuseum (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const profiles = await client.getSkyblockProfiles('Skreewy'); @@ -28,7 +28,7 @@ test('getSkyblockMuseum (raw)', async () => { }); test('getSkyblockMuseum', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const profiles = await client.getSkyblockProfiles('Skreewy'); diff --git a/src/API/getSkyblockNews.test.ts b/src/API/getSkyblockNews.test.ts index a57db120..1ba562e6 100644 --- a/src/API/getSkyblockNews.test.ts +++ b/src/API/getSkyblockNews.test.ts @@ -3,7 +3,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getSkyblockNews (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockNews({ raw: true }); @@ -13,7 +13,7 @@ test('getSkyblockNews (raw)', async () => { }); test('getSkyblockNews', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockNews(); diff --git a/src/API/getSkyblockProfiles.test.ts b/src/API/getSkyblockProfiles.test.ts index 2534cca6..f4aef12d 100644 --- a/src/API/getSkyblockProfiles.test.ts +++ b/src/API/getSkyblockProfiles.test.ts @@ -4,7 +4,7 @@ import { expect, expectTypeOf, test } from 'vitest'; import Client from '../Client'; test('getSkyblockProfiles (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockProfiles('14727faefbdc4aff848cd2713eb9939e', { raw: true }); @@ -14,7 +14,7 @@ test('getSkyblockProfiles (raw)', async () => { }); test('getSkyblockProfiles (no input)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockProfiles()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID); @@ -22,7 +22,7 @@ test('getSkyblockProfiles (no input)', () => { }); test('getSkyblockProfiles (no profiles)', () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error expect(() => client.getSkyblockProfiles('b45add7b081443909fb00aa9a3e15eb0')).rejects.toThrowError( @@ -32,7 +32,7 @@ test('getSkyblockProfiles (no profiles)', () => { }); test('getSkyblockProfiles', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockProfiles('14727faefbdc4aff848cd2713eb9939e'); @@ -76,7 +76,7 @@ test('getSkyblockProfiles', async () => { }); test('getSkyblockProfiles (garden)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockProfiles('kathund', { garden: true }); @@ -120,7 +120,7 @@ test('getSkyblockProfiles (garden)', async () => { }); test('getSkyblockProfiles (museum)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getSkyblockProfiles('14727faefbdc4aff848cd2713eb9939e', { museum: true }); diff --git a/src/API/getStatus.test.ts b/src/API/getStatus.test.ts index e4dbaff1..3a1a5310 100644 --- a/src/API/getStatus.test.ts +++ b/src/API/getStatus.test.ts @@ -4,7 +4,7 @@ import Status from '../structures/Status'; import Client from '../Client'; test('getStatus (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getStatus('14727faefbdc4aff848cd2713eb9939e', { raw: true }); @@ -14,7 +14,7 @@ test('getStatus (raw)', async () => { }); test('getStatus', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getStatus('14727faefbdc4aff848cd2713eb9939e'); diff --git a/src/API/getWatchdogStats.test.ts b/src/API/getWatchdogStats.test.ts index 82748f56..8e59fa75 100644 --- a/src/API/getWatchdogStats.test.ts +++ b/src/API/getWatchdogStats.test.ts @@ -3,7 +3,7 @@ import WatchdogStats from '../structures/Watchdog/Stats'; import Client from '../Client'; test('getWatchdogStats (raw)', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getWatchdogStats({ raw: true }); @@ -13,7 +13,7 @@ test('getWatchdogStats (raw)', async () => { }); test('getWatchdogStats', async () => { - const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false }); + const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' }); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const data = await client.getWatchdogStats(); diff --git a/src/Private/RateLimit.ts b/src/Private/RateLimit.ts index 3faaa164..19311d7b 100644 --- a/src/Private/RateLimit.ts +++ b/src/Private/RateLimit.ts @@ -32,6 +32,7 @@ class RateLimit { if (this.initialized) return; await this.sync(); this.initialized = true; + console.log(this); } } diff --git a/src/Private/Requests.ts b/src/Private/Requests.ts index 5a588d66..8bced93a 100644 --- a/src/Private/Requests.ts +++ b/src/Private/Requests.ts @@ -1,4 +1,4 @@ -const BASE_URL = 'https://api.hypixel.net/v2'; +const BASE_URL = 'https:/api.hypixel.net/v2'; import isUUID from '../utils/isUUID'; import Client from '../Client'; import axios from 'axios'; @@ -33,6 +33,9 @@ class RequestData { } } +import https from 'https'; +const httpsAgent = new https.Agent({ rejectUnauthorized: false }); + class Requests { readonly client: Client; constructor(client: Client) { @@ -51,7 +54,7 @@ class Requests { timestamp: data.timestamp }); } - const res = await axios.get(BASE_URL + endpoint, { headers: { 'API-Key': this.client.key } }); + const res = await axios.get(BASE_URL + endpoint, { httpsAgent, headers: { 'API-Key': this.client.key } }); if (500 <= res.status && 528 > res.status) { throw new Error( this.client.errors.ERROR_STATUSTEXT.replace(/{statustext}/, `Server Error : ${res.status} ${res.statusText}`) @@ -93,7 +96,7 @@ class Requests { if (!input) throw new Error(this.client.errors.NO_NICKNAME_UUID); if ('string' !== typeof input) throw new Error(this.client.errors.UUID_NICKNAME_MUST_BE_A_STRING); if (isUUID(input)) return input.replace(/-/g, ''); - const url = `https://mowojang.matdoes.dev/${input}`; + const url = `http://localhost:3000/uuid/${input}`; if (this.client.cacheHandler.has(url)) { return this.client.cacheHandler.get(url); } diff --git a/src/Private/Updater.ts b/src/Private/Updater.ts index 971028dc..5e848db9 100644 --- a/src/Private/Updater.ts +++ b/src/Private/Updater.ts @@ -26,7 +26,7 @@ class Updater { } async getLatestVersion(): Promise { - const request = await axios.get('https://registry.npmjs.org/hypixel-api-reborn'); + const request = await axios.get('http://localhost:3000/npm/hypixel-api-reborn'); if (200 !== request.status) throw new Error(this.client.errors.UPDATER_REQUEST_NOT_OK); return request.data['dist-tags'].latest; }