hypixel-api-reborn 11.3.5 → 11.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypixel-api-reborn",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.6",
|
|
4
4
|
"description": "Feature-rich Hypixel API wrapper for Node.js",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./typings/index.d.ts",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"publisher": "StavZ",
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@discordjs/docgen": "github:discordjs/docgen",
|
|
45
|
-
"@types/node": "^22.5.
|
|
45
|
+
"@types/node": "^22.5.5",
|
|
46
46
|
"chai": "^4.3.4",
|
|
47
|
-
"eslint": "^9.
|
|
48
|
-
"eslint-plugin-jsdoc": "^50.2.
|
|
47
|
+
"eslint": "^9.10.0",
|
|
48
|
+
"eslint-plugin-jsdoc": "^50.2.3",
|
|
49
49
|
"globals": "^15.9.0",
|
|
50
50
|
"mocha": "^10.4.0",
|
|
51
51
|
"node-env-run": "^4.0.2",
|
package/src/Errors.js
CHANGED
|
@@ -62,5 +62,7 @@ module.exports = {
|
|
|
62
62
|
INVALID_UPDATE_OPTION: '[hypixel-api-reborn] Invalid Value for update : must be a boolean',
|
|
63
63
|
INVALID_THIRD_PARTY_API_OPTION: '[hypixel-api-reborn] Invalid Third Party API option : must be a boolean or string',
|
|
64
64
|
BAD_AUCTION_FILTER:
|
|
65
|
-
'[hypixel-api-reborn] Unexpected filter for Client#getSkyblockAuction. Expected one of "PLAYER", "AUCTION", "PROFILE", but got something else.'
|
|
65
|
+
'[hypixel-api-reborn] Unexpected filter for Client#getSkyblockAuction. Expected one of "PLAYER", "AUCTION", "PROFILE", but got something else.',
|
|
66
|
+
RECENT_REQUEST:
|
|
67
|
+
'[Hypixel-API-Reborn] You have requested that player recently. Try turning on cache. For help join our Discord Server https://discord.gg/NSEBNMM'
|
|
66
68
|
};
|
package/src/Private/requests.js
CHANGED
|
@@ -32,6 +32,12 @@ class Requests {
|
|
|
32
32
|
}
|
|
33
33
|
if (403 === res.status) throw new Error(Errors.INVALID_API_KEY);
|
|
34
34
|
if (422 === res.status) throw new Error(Errors.UNEXPECTED_ERROR);
|
|
35
|
+
if (
|
|
36
|
+
429 === res.status &&
|
|
37
|
+
'You have already looked up this player too recently, please try again shortly' === parsedRes.cause
|
|
38
|
+
) {
|
|
39
|
+
throw new Error(Errors.RECENT_REQUEST);
|
|
40
|
+
}
|
|
35
41
|
if (429 === res.status) throw new Error(Errors.RATE_LIMIT_EXCEEDED);
|
|
36
42
|
if (200 !== res.status) throw new Error(Errors.ERROR_STATUSTEXT.replace(/{statustext}/, res.statusText));
|
|
37
43
|
if (!parsedRes.success && !endpoint.startsWith('/housing')) {
|
|
@@ -14,8 +14,7 @@ class UHCGamemode {
|
|
|
14
14
|
* @param {object} data UHC data
|
|
15
15
|
* @param {string} mode UHC Mode Name
|
|
16
16
|
*/
|
|
17
|
-
constructor(data, mode) {
|
|
18
|
-
if (mode) mode = `_${mode}`;
|
|
17
|
+
constructor(data, mode = '') {
|
|
19
18
|
/**
|
|
20
19
|
* Kills
|
|
21
20
|
* @type {number}
|
|
@@ -76,7 +75,7 @@ class UHC {
|
|
|
76
75
|
* Solo
|
|
77
76
|
* @type {UHCGamemode}
|
|
78
77
|
*/
|
|
79
|
-
this.solo = new UHCGamemode(data, '
|
|
78
|
+
this.solo = new UHCGamemode(data, '_solo');
|
|
80
79
|
/**
|
|
81
80
|
* Teams
|
|
82
81
|
* @type {UHCGamemode}
|
|
@@ -86,27 +85,27 @@ class UHC {
|
|
|
86
85
|
* Red vs Blue
|
|
87
86
|
* @type {UHCGamemode}
|
|
88
87
|
*/
|
|
89
|
-
this.redVsBlue = new UHCGamemode(data, '
|
|
88
|
+
this.redVsBlue = new UHCGamemode(data, '_red_vs_blue');
|
|
90
89
|
/**
|
|
91
90
|
* No Diamond
|
|
92
91
|
* @type {UHCGamemode}
|
|
93
92
|
*/
|
|
94
|
-
this.noDiamond = new UHCGamemode(data, '
|
|
93
|
+
this.noDiamond = new UHCGamemode(data, '_no_diamonds');
|
|
95
94
|
/**
|
|
96
95
|
* Brawl
|
|
97
96
|
* @type {UHCGamemode}
|
|
98
97
|
*/
|
|
99
|
-
this.brawl = new UHCGamemode(data, '
|
|
98
|
+
this.brawl = new UHCGamemode(data, '_brawl');
|
|
100
99
|
/**
|
|
101
100
|
* Solo brawl
|
|
102
101
|
* @type {UHCGamemode}
|
|
103
102
|
*/
|
|
104
|
-
this.soloBrawl = new UHCGamemode(data, '
|
|
103
|
+
this.soloBrawl = new UHCGamemode(data, '_solo_brawl');
|
|
105
104
|
/**
|
|
106
105
|
* Duo Brawl
|
|
107
106
|
* @type {UHCGamemode}
|
|
108
107
|
*/
|
|
109
|
-
this.duoBrawl = new UHCGamemode(data, '
|
|
108
|
+
this.duoBrawl = new UHCGamemode(data, '_duo_brawl');
|
|
110
109
|
/**
|
|
111
110
|
* Wins
|
|
112
111
|
* @type {number}
|
|
@@ -32,7 +32,10 @@ class BaseAuction {
|
|
|
32
32
|
* Item bytes
|
|
33
33
|
* @type {ItemBytes|null}
|
|
34
34
|
*/
|
|
35
|
-
this.itemBytes =
|
|
35
|
+
this.itemBytes =
|
|
36
|
+
includeItemBytes && data.item_bytes
|
|
37
|
+
? new ItemBytes(data.item_bytes.data ? data.item_bytes.data : data.item_bytes)
|
|
38
|
+
: null;
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Auction ID
|
package/src/utils/Guild.js
CHANGED
|
@@ -8,6 +8,7 @@ function parseDate(date) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
function parseHistory(historyData) {
|
|
11
|
+
const expValuesReversed = Object.values(historyData).reverse();
|
|
11
12
|
return Object.entries(historyData).map((x, index) => ({
|
|
12
13
|
day: x[0],
|
|
13
14
|
date:
|
|
@@ -18,9 +19,7 @@ function parseHistory(historyData) {
|
|
|
18
19
|
.map((x) => parseInt(x, 10))
|
|
19
20
|
) || undefined,
|
|
20
21
|
exp: x[1] || 0,
|
|
21
|
-
totalExp:
|
|
22
|
-
.slice(0, index + 1)
|
|
23
|
-
.reduce((pV, cV) => pV + cV, 0)
|
|
22
|
+
totalExp: expValuesReversed.slice(0, expValuesReversed.length - index).reduce((pV, cV) => pV + cV)
|
|
24
23
|
}));
|
|
25
24
|
}
|
|
26
25
|
|
package/typings/index.d.ts
CHANGED
|
@@ -2756,11 +2756,14 @@ declare module 'hypixel-api-reborn' {
|
|
|
2756
2756
|
mages: number;
|
|
2757
2757
|
};
|
|
2758
2758
|
trophyFish: {
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2759
|
+
rank: 'Diamond' | 'Gold' | 'Silver' | 'Bronze' | null;
|
|
2760
|
+
caught: {
|
|
2761
|
+
total: number;
|
|
2762
|
+
bronze: number;
|
|
2763
|
+
silver: number;
|
|
2764
|
+
gold: number;
|
|
2765
|
+
diamond: number;
|
|
2766
|
+
};
|
|
2764
2767
|
};
|
|
2765
2768
|
kuudra: {
|
|
2766
2769
|
none: number;
|