Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Sep 1, 2024
2 parents c3e9991 + bfe2c5a commit f7a8be8
Show file tree
Hide file tree
Showing 134 changed files with 2,262 additions and 2,241 deletions.
2 changes: 1 addition & 1 deletion .github/checkCoverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (95 > (info.coveredstatements / info.statements) * 100) {
throw new Error('Statements is required to be 95% or higher');
}

if (95 > ((info.coveredconditionals / info.conditionals) * 100)) {
if (95 > (info.coveredconditionals / info.conditionals) * 100) {
throw new Error('Conditionals is required to be 95% or higher');
}

Expand Down
8 changes: 7 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import globals from 'globals';
import prettier from 'eslint-config-prettier';
import sortImports from '@j4cobi/eslint-plugin-sort-imports';
import ts from 'typescript-eslint';
import globals from 'globals';

export default [
...ts.configs.recommended,
Expand All @@ -15,7 +16,12 @@ export default [
...globals.node
}
},
plugins: { 'sort-imports': sortImports },
rules: {
'sort-imports/sort-imports': [
'error',
{ ignoreCase: false, ignoreMemberSort: false, memberSyntaxSortOrder: ['all', 'single', 'multiple', 'none'] }
],
'max-len': ['error', { code: 120, ignoreUrls: true, ignoreComments: true }],
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
'no-constant-condition': ['error', { checkLoops: false }],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"packageManager": "[email protected]",
"author": "Kathund",
"dependencies": {
"farming-weight": "^0.4.12",
"axios": "^1.7.5",
"farming-weight": "^0.4.12",
"node-cache": "^5.1.2",
"prismarine-nbt": "^2.5.0",
"rss-parser": "^3.13.0",
Expand All @@ -47,6 +47,7 @@
"publisher": "Kathund",
"devDependencies": {
"@eslint/js": "^9.9.1",
"@j4cobi/eslint-plugin-sort-imports": "^1.0.2",
"@types/eslint": "^9.6.1",
"@types/node": "^20.16.2",
"@types/xml2js": "^0.4.14",
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/API/API.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ export interface SkyblockRequestOptions extends RequestOptions {
garden?: boolean;
museum?: boolean;
}

export type GuildFetchOptions = 'id' | 'name' | 'player';
8 changes: 4 additions & 4 deletions src/API/getAchievements.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import GameAchievements from '../structures/Static/GameAchievements';
import Achievement from '../structures/Static/Achievement';
import AchievementTier from '../structures/Static/AchievementTier';
import Achievements from '../structures/Static/Achievements';
import Achievement from '../structures/Static/Achievement';
import { expect, expectTypeOf, test } from 'vitest';
import { StaticGameNames } from '../typings';
import Client from '../Client';
import GameAchievements from '../structures/Static/GameAchievements';
import { StaticGameNames } from '../typings';
import { expect, expectTypeOf, test } from 'vitest';

test('getAchievements (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
4 changes: 2 additions & 2 deletions src/API/getAchievements.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Achievements from '../structures/Static/Achievements';
import { RequestOptions } from '../Private/Requests';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import { RequestOptions } from '../Private/Requests';

class getAchievements extends Endpoint {
readonly client: Client;
Expand Down
4 changes: 2 additions & 2 deletions src/API/getActiveHouses.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, expectTypeOf, test } from 'vitest';
import House from '../structures/House';
import Client from '../Client';
import House from '../structures/House';
import { expect, expectTypeOf, test } from 'vitest';

test('getActiveHouses (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
4 changes: 2 additions & 2 deletions src/API/getActiveHouses.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RequestOptions } from '../Private/Requests';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import House from '../structures/House';
import Client from '../Client';
import { RequestOptions } from '../Private/Requests';

class getActiveHouses extends Endpoint {
readonly client: Client;
Expand Down
4 changes: 2 additions & 2 deletions src/API/getBoosters.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Game, { GameCode, GameID, GameString } from '../structures/Game';
import Booster from '../structures/Boosters/Booster';
import { expect, expectTypeOf, test } from 'vitest';
import Client from '../Client';
import Game, { GameCode, GameID, GameString } from '../structures/Game';
import { expect, expectTypeOf, test } from 'vitest';

test('getBoosters (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
4 changes: 2 additions & 2 deletions src/API/getBoosters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RequestOptions } from '../Private/Requests';
import Booster from '../structures/Boosters/Booster';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import { RequestOptions } from '../Private/Requests';

class getBoosters extends Endpoint {
readonly client: Client;
Expand Down
6 changes: 3 additions & 3 deletions src/API/getChallenges.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import GameChallenges, { ChallengeData } from '../structures/Static/GameChallenges';
import Challenges from '../structures/Static/Challenges';
import { expect, expectTypeOf, test } from 'vitest';
import { StaticGameNames } from '../typings';
import Client from '../Client';
import GameChallenges, { ChallengeData } from '../structures/Static/GameChallenges';
import { StaticGameNames } from '../typings';
import { expect, expectTypeOf, test } from 'vitest';

test('getChallenges (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
4 changes: 2 additions & 2 deletions src/API/getChallenges.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Challenges from '../structures/Static/Challenges';
import { RequestOptions } from '../Private/Requests';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import { RequestOptions } from '../Private/Requests';

class getChallenges extends Endpoint {
readonly client: Client;
Expand Down
4 changes: 2 additions & 2 deletions src/API/getGameCounts.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, expectTypeOf, test } from 'vitest';
import GameCounts from '../structures/GameCounts';
import Client from '../Client';
import GameCounts from '../structures/GameCounts';
import { expect, expectTypeOf, test } from 'vitest';

test('getGameCounts (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
6 changes: 3 additions & 3 deletions src/API/getGameCounts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RequestOptions } from '../Private/Requests';
import GameCounts from '../structures/GameCounts';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import GameCounts from '../structures/GameCounts';
import { RequestOptions } from '../Private/Requests';

class getGameCounts extends Endpoint {
readonly client: Client;
Expand Down
6 changes: 3 additions & 3 deletions src/API/getGuild.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Client from '../Client';
import Color, { ColorCode, ColorHex, ColorString, InGameCode } from '../structures/Color';
import Game, { GameCode, GameID, GameString } from '../structures/Game';
import Guild from '../structures/Guild/Guild';
import GuildMember from '../structures/Guild/GuildMember';
import GuildRank from '../structures/Guild/GuildRank';
import { expect, expectTypeOf, test } from 'vitest';
import Guild from '../structures/Guild/Guild';
import { ExpHistory } from '../utils/Guild';
import Client from '../Client';
import { expect, expectTypeOf, test } from 'vitest';

test('Invalid Guild Type', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
13 changes: 5 additions & 8 deletions src/API/getGuild.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { RequestOptions } from '../Private/Requests';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import Guild from '../structures/Guild/Guild';
import isGuildID from '../utils/isGuildID';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import { GuildFetchOptions } from './API';
import { RequestOptions } from '../Private/Requests';

class getGuild extends Endpoint {
readonly client: Client;
Expand All @@ -11,11 +12,7 @@ class getGuild extends Endpoint {
this.client = client;
}

async execute(
searchParameter: 'id' | 'name' | 'player',
query: string,
options?: RequestOptions
): Promise<Guild | null> {
async execute(searchParameter: GuildFetchOptions, query: string, options?: RequestOptions): Promise<Guild | null> {
if (!query) throw new Error(this.client.errors.NO_GUILD_QUERY);
if ('id' === searchParameter && !isGuildID(query)) throw new Error(this.client.errors.INVALID_GUILD_ID);
const isPlayerQuery = 'player' === searchParameter;
Expand Down
6 changes: 3 additions & 3 deletions src/API/getGuildAchievements.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import GuildAchievements from '../structures/Static/GuildAchievements';
import AchievementTier from '../structures/Static/AchievementTier';
import Achievement from '../structures/Static/Achievement';
import { expect, expectTypeOf, test } from 'vitest';
import AchievementTier from '../structures/Static/AchievementTier';
import Client from '../Client';
import GuildAchievements from '../structures/Static/GuildAchievements';
import { expect, expectTypeOf, test } from 'vitest';

test('getGuildAchievements (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
4 changes: 2 additions & 2 deletions src/API/getGuildAchievements.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import GuildAchievements from '../structures/Static/GuildAchievements';
import { RequestOptions } from '../Private/Requests';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';

class getGuildAchievements extends Endpoint {
readonly client: Client;
Expand Down
4 changes: 2 additions & 2 deletions src/API/getHouse.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, expectTypeOf, test } from 'vitest';
import House from '../structures/House';
import Client from '../Client';
import House from '../structures/House';
import { expect, expectTypeOf, test } from 'vitest';

test('getHouse (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
4 changes: 2 additions & 2 deletions src/API/getHouse.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RequestOptions } from '../Private/Requests';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import House from '../structures/House';
import Client from '../Client';
import { RequestOptions } from '../Private/Requests';

class getHouse extends Endpoint {
readonly client: Client;
Expand Down
4 changes: 2 additions & 2 deletions src/API/getLeaderboards.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, expectTypeOf, test, vi } from 'vitest';
import Leaderboard from '../structures/Leaderboard';
import Client from '../Client';
import Leaderboard from '../structures/Leaderboard';
import axios from 'axios';
import { expect, expectTypeOf, test, vi } from 'vitest';

test('getLeaderboards (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
6 changes: 3 additions & 3 deletions src/API/getLeaderboards.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RequestOptions } from '../Private/Requests';
import Leaderboard from '../structures/Leaderboard';
import Client from '../Client';
import Constants from '../utils/Constants';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import Leaderboard from '../structures/Leaderboard';
import { RequestOptions } from '../Private/Requests';

class getLeaderboards extends Endpoint {
readonly client: Client;
Expand Down
42 changes: 21 additions & 21 deletions src/API/getPlayer.test.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import Arcade from '../structures/MiniGames/Arcade';
import ArenaBrawl from '../structures/MiniGames/ArenaBrawl';
import BedWars from '../structures/MiniGames/BedWars';
import BlitzSurvivalGames from '../structures/MiniGames/BlitzSurvivalGames';
import BuildBattle from '../structures/MiniGames/BuildBattle';
import Client from '../Client';
import Color, { ColorCode, ColorHex, ColorString, InGameCode } from '../structures/Color';
import CopsAndCrims from '../structures/MiniGames/CopsAndCrims';
import Duels from '../structures/MiniGames/Duels';
import Guild from '../structures/Guild/Guild';
import House from '../structures/House';
import MegaWalls from '../structures/MiniGames/MegaWalls';
import MurderMystery from '../structures/MiniGames/MurderMystery';
import Paintball from '../structures/MiniGames/Paintball';
import Pit from '../structures/MiniGames/Pit';
import Player, {
LevelProgress,
PlayerRank,
PlayerSocialMedia,
PlayerStats,
RanksPurchaseTime
} from '../structures/Player';
import Color, { ColorCode, ColorHex, ColorString, InGameCode } from '../structures/Color';
import BlitzSurvivalGames from '../structures/MiniGames/BlitzSurvivalGames';
import TurboKartRacers from '../structures/MiniGames/TurboKartRacers';
import MurderMystery from '../structures/MiniGames/MurderMystery';
import CopsAndCrims from '../structures/MiniGames/CopsAndCrims';
import SmashHeroes from '../structures/MiniGames/SmashHeroes';
import BuildBattle from '../structures/MiniGames/BuildBattle';
import PlayerCosmetics from '../structures/PlayerCosmetics';
import ArenaBrawl from '../structures/MiniGames/ArenaBrawl';
import Quakecraft from '../structures/MiniGames/Quakecraft';
import MegaWalls from '../structures/MiniGames/MegaWalls';
import Paintball from '../structures/MiniGames/Paintball';
import RecentGame from '../structures/RecentGame';
import SkyWars from '../structures/MiniGames/SkyWars';
import SmashHeroes from '../structures/MiniGames/SmashHeroes';
import SpeedUHC from '../structures/MiniGames/SpeedUHC';
import { expect, expectTypeOf, test, vi } from 'vitest';
import TNTGames from '../structures/MiniGames/TNTGames';
import TurboKartRacers from '../structures/MiniGames/TurboKartRacers';
import UHC from '../structures/MiniGames/UHC';
import VampireZ from '../structures/MiniGames/VampireZ';
import Walls from '../structures/MiniGames/Walls';
import Warlords from '../structures/MiniGames/Warlords';
import WoolWars from '../structures/MiniGames/WoolWars';
import BedWars from '../structures/MiniGames/BedWars';
import SkyWars from '../structures/MiniGames/SkyWars';
import RecentGame from '../structures/RecentGame';
import Walls from '../structures/MiniGames/Walls';
import Duels from '../structures/MiniGames/Duels';
import Pit from '../structures/MiniGames/Pit';
import UHC from '../structures/MiniGames/UHC';
import Guild from '../structures/Guild/Guild';
import House from '../structures/House';
import Client from '../Client';
import axios from 'axios';
import { expect, expectTypeOf, test, vi } from 'vitest';

test('getPlayer (never joinned hypixel)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
4 changes: 2 additions & 2 deletions src/API/getPlayer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PlayerRequestOptions } from './API';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import Player from '../structures/Player';
import Client from '../Client';
import { PlayerRequestOptions } from './API';

class getPlayer extends Endpoint {
readonly client: Client;
Expand Down
4 changes: 2 additions & 2 deletions src/API/getPlayerHouses.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, expectTypeOf, test } from 'vitest';
import House from '../structures/House';
import Client from '../Client';
import House from '../structures/House';
import { expect, expectTypeOf, test } from 'vitest';

test('getPlayerHouses (No input)', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false, rateLimit: 'NONE' });
Expand Down
4 changes: 2 additions & 2 deletions src/API/getPlayerHouses.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RequestOptions } from '../Private/Requests';
import Client from '../Client';
import Endpoint from '../Private/Endpoint';
import House from '../structures/House';
import Client from '../Client';
import { RequestOptions } from '../Private/Requests';

class getPlayerHouses extends Endpoint {
readonly client: Client;
Expand Down
Loading

0 comments on commit f7a8be8

Please sign in to comment.