hypixel-api-reborn 11.3.2 → 11.3.4

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.2",
3
+ "version": "11.3.4",
4
4
  "description": "Feature-rich Hypixel API wrapper for Node.js",
5
5
  "main": "./src/index.js",
6
6
  "types": "./typings/index.d.ts",
@@ -16,12 +16,12 @@
16
16
  "url": "https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/issues"
17
17
  },
18
18
  "scripts": {
19
- "lint": "npx eslint --cache src/",
20
- "lint:fix": "npx eslint --cache src/ --fix",
19
+ "lint": "npx eslint src/",
20
+ "lint:fix": "npx eslint src/ --fix",
21
21
  "tests": "npx mocha tests --exit --recursive",
22
22
  "docgen": " npx docgen -s src/ --custom docs/index.yml -o ./master.json",
23
- "prettier": "npx prettier --cache --write src/ typings/",
24
- "prettier:check": "npx prettier --cache --check src/ typings/"
23
+ "prettier": "npx prettier --write src/ typings/",
24
+ "prettier:check": "npx prettier --check src/ typings/"
25
25
  },
26
26
  "engines": {
27
27
  "node": ">=18.18.0"
@@ -32,7 +32,7 @@
32
32
  "node-fetch": "^3.3.2",
33
33
  "prismarine-nbt": "^2.5.0",
34
34
  "rss-parser": "^3.13.0",
35
- "skyhelper-networth": "^1.21.0"
35
+ "skyhelper-networth": "^1.23.0"
36
36
  },
37
37
  "license": "MIT",
38
38
  "readme": "https://hypixel.stavzdev.me/",
@@ -42,15 +42,15 @@
42
42
  "publisher": "StavZ",
43
43
  "devDependencies": {
44
44
  "@discordjs/docgen": "github:discordjs/docgen",
45
- "@types/node": "^20.14.11",
45
+ "@types/node": "^22.1.0",
46
46
  "chai": "^4.3.4",
47
- "eslint": "^9.7.0",
48
- "eslint-plugin-jsdoc": "^48.8.3",
49
- "globals": "^15.8.0",
47
+ "eslint": "^9.8.0",
48
+ "eslint-plugin-jsdoc": "^49.0.0",
49
+ "globals": "^15.9.0",
50
50
  "mocha": "^10.4.0",
51
51
  "node-env-run": "^4.0.2",
52
52
  "path": "^0.12.7",
53
53
  "prettier": "^3.3.3",
54
- "typescript": "^5.5.3"
54
+ "typescript": "^5.5.4"
55
55
  }
56
56
  }
@@ -2,9 +2,10 @@
2
2
  const Auction = require('../../structures/SkyBlock/Auctions/Auction');
3
3
  const AuctionInfo = require('../../structures/SkyBlock/Auctions/AuctionInfo');
4
4
  const Errors = require('../../Errors');
5
+ // eslint-disable-next-line no-underscore-dangle
6
+ let _makeRequest;
5
7
  async function getPage(page = 0, options = {}) {
6
- // eslint-disable-next-line no-underscore-dangle
7
- const content = await this._makeRequest(`/skyblock/auctions?page=${page}`, false);
8
+ const content = await _makeRequest(`/skyblock/auctions?page=${page}`, false);
8
9
  const result = {};
9
10
  if (!options.noInfo) result.info = new AuctionInfo(content);
10
11
  if (options.raw) result.auctions = content.auctions;
@@ -25,6 +26,8 @@ async function noReject(promise, args = [], retries = 3, cooldown = 100) {
25
26
  }
26
27
  }
27
28
  module.exports = async function (range, options = {}) {
29
+ // eslint-disable-next-line no-underscore-dangle
30
+ _makeRequest = this._makeRequest;
28
31
  options.retries ||= 3;
29
32
  options.cooldown ||= 100;
30
33
  if (null === range || '*' === range) range = [0, (await getPage(0, { noAuctions: true })).info.totalPages];
@@ -37,7 +40,7 @@ module.exports = async function (range, options = {}) {
37
40
  throw new Error(Errors.INVALID_OPTION_VALUE);
38
41
  }
39
42
  range = range.sort();
40
- const result = { auctions: [] };
43
+ const result = { info: null, Auctions: [] };
41
44
  const fetches = [];
42
45
  const failedPages = [];
43
46
  if (options.noAuctions) return { info: options.noInfo ? null : (await getPage(range[1], { noAuctions: true })).info };
@@ -47,7 +50,7 @@ module.exports = async function (range, options = {}) {
47
50
  } else {
48
51
  const resp = await noReject(getPage, [i, options], options.retries, options.cooldown);
49
52
  if (resp) {
50
- result.auctions = result.auctions.concat(resp.auctions);
53
+ result.Auctions = result.Auctions.concat(resp.auctions);
51
54
  if (resp.info) result.info = resp.info;
52
55
  } else {
53
56
  failedPages.push(i);
@@ -55,7 +58,7 @@ module.exports = async function (range, options = {}) {
55
58
  }
56
59
  }
57
60
  if (fetches.length) {
58
- result.auctions = (await Promise.all(fetches)).reduce((pV, cV, index) => {
61
+ result.Auctions = (await Promise.all(fetches)).reduce((pV, cV, index) => {
59
62
  if (!cV) {
60
63
  failedPages.push(index + range[0]);
61
64
  return pV;
@@ -1,7 +1,11 @@
1
1
  module.exports = async function (profileId) {
2
2
  const SkyblockGarden = require('../../structures/SkyBlock/SkyblockGarden');
3
- // eslint-disable-next-line no-underscore-dangle
4
- const res = await this._makeRequest(`/skyblock/garden?profile=${profileId}`);
5
- if (res.raw) return res;
3
+ let res;
4
+ try {
5
+ // eslint-disable-next-line no-underscore-dangle
6
+ res = await this._makeRequest(`/skyblock/garden?profile=${profileId}`).catch();
7
+ // eslint-disable-next-line no-unused-vars, no-empty
8
+ } catch (e) {}
9
+ if (res?.raw) return res;
6
10
  return new SkyblockGarden(res);
7
11
  };
package/src/Client.js CHANGED
@@ -348,12 +348,7 @@ class Client extends EventEmitter {
348
348
  * @name Client#getSkyblockAuctions
349
349
  * @param {string|number|number[]} page - "*", a page number, or an array with the start and the end page number ( automatically sorted )
350
350
  * @param {auctionsOptions} [options={}] Options
351
- * @return {Promise<{info:AuctionInfo,auctions:Auction[]}>}
352
- * @example
353
- * hypixel.getSkyblockAuctions(0).then(auctions =>{
354
- * console.log(auctions[0].item); // Mythic Farmer Boots
355
- * })
356
- * .catch(console.log);
351
+ * @return {Promise<{info:AuctionInfo,Auctions:Auction[]}>}
357
352
  */
358
353
  /**
359
354
  * Allows you to get player's skyblock auctions
@@ -17,22 +17,22 @@ class SkyblockGarden {
17
17
  * Current Barn Skin
18
18
  * @type {string}
19
19
  */
20
- this.barnSkin = data.garden?.selected_barn_skin || '';
20
+ this.barnSkin = data?.garden?.selected_barn_skin || '';
21
21
  /**
22
22
  * Unlocked Plots
23
23
  * @type {string[]}
24
24
  */
25
- this.unlockedPlots = data.garden?.unlocked_plots_ids || [];
25
+ this.unlockedPlots = data?.garden?.unlocked_plots_ids || [];
26
26
  /**
27
27
  * Visitor Stats
28
28
  * @type {SkyblockGardenVisitor}
29
29
  */
30
30
  this.visitors = {
31
- visited: data.garden?.commission_data?.visits || {},
32
- completed: data.garden?.commission_data?.completed || {},
31
+ visited: data?.garden?.commission_data?.visits || {},
32
+ completed: data?.garden?.commission_data?.completed || {},
33
33
  served: {
34
- total: data.garden?.commission_data?.total_completed || 0,
35
- unique: data.garden?.commission_data?.unique_npcs_served || 0
34
+ total: data?.garden?.commission_data?.total_completed || 0,
35
+ unique: data?.garden?.commission_data?.unique_npcs_served || 0
36
36
  }
37
37
  };
38
38
  /**
@@ -40,33 +40,33 @@ class SkyblockGarden {
40
40
  * @type {SkyblockGarenCropMilestones}
41
41
  */
42
42
  this.cropMilestones = {
43
- wheat: getLevelByXp(data.garden?.resources_collected?.WHEAT || 0, 'wheat'),
44
- carrot: getLevelByXp(data.garden?.resources_collected?.CARROT_ITEM || 0, 'carrot'),
45
- sugarCane: getLevelByXp(data.garden?.resources_collected?.SUGAR_CANE || 0, 'sugarCane'),
46
- potato: getLevelByXp(data.garden?.resources_collected?.POTATO_ITEM || 0, 'potato'),
47
- pumpkin: getLevelByXp(data.garden?.resources_collected?.PUMPKIN || 0, 'pumpkin'),
48
- melon: getLevelByXp(data.garden?.resources_collected?.MELON || 0, 'melon'),
49
- cactus: getLevelByXp(data.garden?.resources_collected?.CACTUS || 0, 'cactus'),
50
- cocoBeans: getLevelByXp(data.garden?.resources_collected?.['INK_SACK:3'] || 0, 'cocoBeans'),
51
- mushroom: getLevelByXp(data.garden?.resources_collected?.MUSHROOM_COLLECTION || 0, 'mushroom'),
52
- netherWart: getLevelByXp(data.garden?.resources_collected?.NETHER_STALK || 0, 'netherWart')
43
+ wheat: getLevelByXp(data?.garden?.resources_collected?.WHEAT || 0, 'wheat'),
44
+ carrot: getLevelByXp(data?.garden?.resources_collected?.CARROT_ITEM || 0, 'carrot'),
45
+ sugarCane: getLevelByXp(data?.garden?.resources_collected?.SUGAR_CANE || 0, 'sugarCane'),
46
+ potato: getLevelByXp(data?.garden?.resources_collected?.POTATO_ITEM || 0, 'potato'),
47
+ pumpkin: getLevelByXp(data?.garden?.resources_collected?.PUMPKIN || 0, 'pumpkin'),
48
+ melon: getLevelByXp(data?.garden?.resources_collected?.MELON || 0, 'melon'),
49
+ cactus: getLevelByXp(data?.garden?.resources_collected?.CACTUS || 0, 'cactus'),
50
+ cocoaBeans: getLevelByXp(data?.garden?.resources_collected?.['INK_SACK:3'] || 0, 'cocoaBeans'),
51
+ mushroom: getLevelByXp(data?.garden?.resources_collected?.MUSHROOM_COLLECTION || 0, 'mushroom'),
52
+ netherWart: getLevelByXp(data?.garden?.resources_collected?.NETHER_STALK || 0, 'netherWart')
53
53
  };
54
54
  /**
55
55
  * Composter
56
56
  * @type {SkyblockGardenComposter}
57
57
  */
58
58
  this.composter = {
59
- organicMatter: data.garden?.composter_data?.organic_matter || 0,
60
- fuelUnits: data.garden?.composter_data?.fuel_units || 0,
61
- compostUnits: data.garden?.composter_data?.compost_units || 0,
62
- compostItems: data.garden?.composter_data?.compost_items || 0,
63
- conversionTicks: data.garden?.composter_data?.conversion_ticks || 0,
59
+ organicMatter: data?.garden?.composter_data?.organic_matter || 0,
60
+ fuelUnits: data?.garden?.composter_data?.fuel_units || 0,
61
+ compostUnits: data?.garden?.composter_data?.compost_units || 0,
62
+ compostItems: data?.garden?.composter_data?.compost_items || 0,
63
+ conversionTicks: data?.garden?.composter_data?.conversion_ticks || 0,
64
64
  upgrades: {
65
- speed: data.garden?.composter_data?.upgrades?.speed || 0,
66
- multiDrop: data.garden?.composter_data?.upgrades?.multi_drop || 0,
67
- fuelCap: data.garden?.composter_data?.upgrades?.fuel_cap || 0,
68
- organicMatterCap: data.garden?.composter_data?.upgrades?.organic_matter_cap || 0,
69
- costReduction: data.garden?.composter_data?.upgrades?.cost_reduction || 0
65
+ speed: data?.garden?.composter_data?.upgrades?.speed || 0,
66
+ multiDrop: data?.garden?.composter_data?.upgrades?.multi_drop || 0,
67
+ fuelCap: data?.garden?.composter_data?.upgrades?.fuel_cap || 0,
68
+ organicMatterCap: data?.garden?.composter_data?.upgrades?.organic_matter_cap || 0,
69
+ costReduction: data?.garden?.composter_data?.upgrades?.cost_reduction || 0
70
70
  }
71
71
  };
72
72
  /**
@@ -74,16 +74,16 @@ class SkyblockGarden {
74
74
  * @type {SkyblockGarenCrops}
75
75
  */
76
76
  this.cropUpgrades = {
77
- wheat: data.garden?.crop_upgrade_levels?.WHEAT || 0,
78
- carrot: data.garden?.crop_upgrade_levels?.CARROT_ITEM || 0,
79
- sugarCane: data.garden?.crop_upgrade_levels?.SUGAR_CANE || 0,
80
- potato: data.garden?.crop_upgrade_levels?.POTATO_ITEM || 0,
81
- pumpkin: data.garden?.crop_upgrade_levels?.PUMPKIN || 0,
82
- melon: data.garden?.crop_upgrade_levels?.MELON || 0,
83
- cactus: data.garden?.crop_upgrade_levels?.CACTUS || 0,
84
- cocoBeans: data.garden?.crop_upgrade_levels?.['INK_SACK:3'] || 0,
85
- mushroom: data.garden?.crop_upgrade_levels?.MUSHROOM_COLLECTION || 0,
86
- netherWart: data.garden?.crop_upgrade_levels?.NETHER_STALK || 0
77
+ wheat: data?.garden?.crop_upgrade_levels?.WHEAT || 0,
78
+ carrot: data?.garden?.crop_upgrade_levels?.CARROT_ITEM || 0,
79
+ sugarCane: data?.garden?.crop_upgrade_levels?.SUGAR_CANE || 0,
80
+ potato: data?.garden?.crop_upgrade_levels?.POTATO_ITEM || 0,
81
+ pumpkin: data?.garden?.crop_upgrade_levels?.PUMPKIN || 0,
82
+ melon: data?.garden?.crop_upgrade_levels?.MELON || 0,
83
+ cactus: data?.garden?.crop_upgrade_levels?.CACTUS || 0,
84
+ cocoaBeans: data?.garden?.crop_upgrade_levels?.['INK_SACK:3'] || 0,
85
+ mushroom: data?.garden?.crop_upgrade_levels?.MUSHROOM_COLLECTION || 0,
86
+ netherWart: data?.garden?.crop_upgrade_levels?.NETHER_STALK || 0
87
87
  };
88
88
  }
89
89
  }
@@ -125,7 +125,7 @@ class SkyblockGarden {
125
125
  * @property {number} pumpkin Pumpkin
126
126
  * @property {number} melon Melon
127
127
  * @property {number} cactus Cactus
128
- * @property {number} cocoBeans Coco Beans
128
+ * @property {number} cocoaBeans Cocoa Beans
129
129
  * @property {number} mushroom Mushroom
130
130
  * @property {number} netherWart Nether Wart
131
131
  */
@@ -138,7 +138,7 @@ class SkyblockGarden {
138
138
  * @property {SkyblockSkillLevel} pumpkin Pumpkin
139
139
  * @property {SkyblockSkillLevel} melon Melon
140
140
  * @property {SkyblockSkillLevel} cactus Cactus
141
- * @property {SkyblockSkillLevel} cocoBeans Coco Beans
141
+ * @property {SkyblockSkillLevel} cocoaBeans Cocoa Beans
142
142
  * @property {SkyblockSkillLevel} mushroom Mushroom
143
143
  * @property {SkyblockSkillLevel} netherWart Nether Wart
144
144
  */