Skip to content

Commit

Permalink
fix(getSkyblockProfiles): profiles.members missing datafields
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed May 17, 2024
1 parent 27d8463 commit 75277bf
Show file tree
Hide file tree
Showing 44 changed files with 1,006 additions and 233 deletions.
38 changes: 11 additions & 27 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,24 @@
{
"env": {
"commonjs": true,
"es2021": true,
"node": true
},
"extends": ["google", "plugin:@typescript-eslint/recommended", "eslint-config-prettier"],
"env": { "commonjs": true, "es2021": true, "node": true },
"parserOptions": { "ecmaVersion": 2021 },
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021
},
"plugins": ["@typescript-eslint"],
"rules": {
"linebreak-style": "off",
"comma-dangle": ["error", "never"],
"valid-jsdoc": [
"error",
{
"requireParamDescription": false,
"requireReturnDescription": false,
"requireReturn": true
}
],
"max-len": [
"error",
{
"code": 210,
"ignoreUrls": true
}
{ "requireParamDescription": false, "requireReturnDescription": false, "requireReturn": true }
],
"max-len": ["error", { "code": 120, "ignoreUrls": true, "ignoreComments": true }],
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": "off",
"quote-props": ["error", "as-needed"],
"object-curly-spacing": "off",
"space-before-function-paren": "off",
"semi": "error",
"no-console": "error",
"@typescript-eslint/no-var-requires": "off",
"comma-dangle": ["error", "never"],
"object-curly-spacing": "off",
"linebreak-style": "off",
"no-extra-semi": "error",
"@typescript-eslint/no-unused-vars": ["off"]
"no-console": "error",
"semi": "error"
}
}
7 changes: 4 additions & 3 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

## Reporting a Vulnerability

If a vulnerability is found within this project, as long as you follow the steps for responsible disclosure, there will be no issue and the team will be greatful for your actions.
If a vulnerability is found within this project, as long as you follow the steps for responsible disclosure, there will
be no issue and the team will be greatful for your actions.

To report a vulnerability you can do so in the [Discord Server](https://discord.gg/NSEBNMM) by openeing a support ticket or you can contact the primary contributor of this repository using the following contact
methods:
To report a vulnerability you can do so in the [Discord Server](https://discord.gg/NSEBNMM) by openeing a support ticket
or you can contact the primary contributor of this repository using the following contact methods:

- @kathund. on Discord
- @kathundd on Telegram
6 changes: 3 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"bracketSpacing": true,
"proseWrap": "always",
"singleQuote": true,
"printWidth": 210,
"printWidth": 120,
"endOfLine": "lf",
"useTabs": false,
"tabWidth": 2,
"semi": true,
"endOfLine": "lf"
"semi": true
}
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@

### Links

[Discord Support](https://discord.gg/NSEBNMM) | [Documentation](https://hypixel-api-reborn.github.io/) | [NPM](https://www.npmjs.com/package/hypixel-api-reborn) |
[GitHub](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn) | [ToDo](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/projects/1) | [CLI](https://github.com/Hypixel-API-Reborn/cli)
[Discord Support](https://discord.gg/NSEBNMM) | [Documentation](https://hypixel-api-reborn.github.io/) |
[NPM](https://www.npmjs.com/package/hypixel-api-reborn) |
[GitHub](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn) |
[ToDo](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/projects/1) |
[CLI](https://github.com/Hypixel-API-Reborn/cli)

#### Requirements

Expand Down
12 changes: 8 additions & 4 deletions docs/general/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
<a href="https://discord.gg/NSEBNMM"><img src="https://discordapp.com/api/guilds/660416184252104705/embed.png"></a>
<a href="https://travis-ci.org/StavZ/hypixel-api-reborn"><img src="https://flat.badgen.net/travis/hypixel-api-reborn/hypixel-api-reborn"></a>
<a href="https://app.codacy.com/gh/Hypixel-API-Reborn/hypixel-api-reborn?utm_source=github.com&utm_medium=referral&utm_content=Hypixel-API-Reborn/hypixel-api-reborn&utm_campaign=Badge_Grade">
<img src="https://flat.badgen.net/codacy/grade/71cd7e95499b496cb2dd11c29b9def33/master"></a> <img src="https://flat.badgen.net/npm/node/hypixel-api-reborn">
<img src="https://flat.badgen.net/npm/v/hypixel-api-reborn"> <img src="https://flat.badgen.net/npm/license/hypixel-api-reborn"><a href="https://github.com/Hypixel-API-Reborn/hypixel-api-reborn">
<img src="https://flat.badgen.net/codacy/grade/71cd7e95499b496cb2dd11c29b9def33/master"></a>
<img src="https://flat.badgen.net/npm/node/hypixel-api-reborn">
<img src="https://flat.badgen.net/npm/v/hypixel-api-reborn">
<img src="https://flat.badgen.net/npm/license/hypixel-api-reborn"><a href="https://github.com/Hypixel-API-Reborn/hypixel-api-reborn">
<img src="https://flat.badgen.net/github/stars/hypixel-api-reborn/hypixel-api-reborn"></a>
<a href="https://www.npmjs.com/package/hypixel-api-reborn"><img src="https://nodei.co/npm/hypixel-api-reborn.png?compact=true"></a> <br>
<a href="https://www.npmjs.com/package/hypixel-api-reborn"><img src="https://nodei.co/npm/hypixel-api-reborn.png?compact=true"></a>
<br>

<h3>Welcome to the hypixel-api-reborn documentation</h3>
</div>
Expand Down Expand Up @@ -56,4 +59,5 @@ hypixel

[Contributing.md](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/blob/master/.github/CONTRIBUTING.md)

Make sure before creating an issue that it hasn't already reported. Please, don't create an issue for feature request, you can do it on our [discord server](https://discord.gg/NSEBNMM).
Make sure before creating an issue that it hasn't already reported. Please, don't create an issue for feature request,
you can do it on our [discord server](https://discord.gg/NSEBNMM).
11 changes: 10 additions & 1 deletion dtslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@
"one-variable-per-declaration": [true, "ignore-for-loop"],
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"prefer-template": [true, "allow-single-concat"],
"whitespace": [true, "check-branch", "check-decl", "check-operator", "check-module", "check-separator", "check-type", "check-typecast"],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast"
],
"align": false,
"arrow-parens": false,
"arrow-return-shorthand": true,
Expand Down
9 changes: 5 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"object-path": "^0.11.8",
"prismarine-nbt": "^2.5.0",
"rss-parser": "^3.13.0",
"skyhelper-networth": "^1.18.5"
"skyhelper-networth": "^1.19.0"
},
"license": "MIT",
"readme": "https://hypixel.stavzdev.me/",
Expand Down
4 changes: 3 additions & 1 deletion src/API/getLeaderboards.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ module.exports = async function () {
const lbnames = Object.create(require('../utils/Constants').leaderboardNames);
// eslint-disable-next-line guard-for-in
for (const name in lbnames) {
lbnames[name] = res.leaderboards[lbnames[name]].length ? res.leaderboards[lbnames[name]].map((lb) => new Leaderboard(lb)) : [];
lbnames[name] = res.leaderboards[lbnames[name]].length
? res.leaderboards[lbnames[name]].map((lb) => new Leaderboard(lb))
: [];
}
return lbnames;
};
4 changes: 3 additions & 1 deletion src/API/getServerInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const net = require('net');
const Errors = require('../Errors');
const ServerInfo = require('../structures/ServerInfo');
const varInt = require('../utils/varInt');
const packetsToSend = ['1500E0050E6D632E6879706978656C2E6E657463DD01', '0100', '09010000000000000000'].map((x) => Buffer.from(x, 'hex')); // To avoid dependency hell, these are precompiled as hex.
const packetsToSend = ['1500E0050E6D632E6879706978656C2E6E657463DD01', '0100', '09010000000000000000'].map((x) =>
Buffer.from(x, 'hex')
); // To avoid dependency hell, these are precompiled as hex.
module.exports = async function (repeats) {
if (repeats < 0 || typeof repeats !== 'number') repeats = 3;
if (repeats > 10) repeats = 10;
Expand Down
6 changes: 4 additions & 2 deletions src/API/skyblock/getAuctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ module.exports = async function (range, options = {}) {
if (range == null || range === '*') range = [0, (await getPage(0, { noAuctions: true })).info.totalPages];
if (!Array.isArray(range)) range = [parseInt(range), parseInt(range)];
if (isNaN(range[0])) throw new Error(Errors.PAGE_INDEX_ERROR);
if (parseInt(options.retries) !== options.retries || options.retries > 10 || options.retries < 0) throw new Error(Errors.INVALID_OPTION_VALUE);
if (parseInt(options.cooldown) !== options.cooldown || options.cooldown > 3000 || options.cooldown < 0) throw new Error(Errors.INVALID_OPTION_VALUE);
if (parseInt(options.retries) !== options.retries || options.retries > 10 || options.retries < 0)
throw new Error(Errors.INVALID_OPTION_VALUE);
if (parseInt(options.cooldown) !== options.cooldown || options.cooldown > 3000 || options.cooldown < 0)
throw new Error(Errors.INVALID_OPTION_VALUE);
range = range.sort();
const result = { auctions: [] };
const fetches = [];
Expand Down
5 changes: 3 additions & 2 deletions src/API/skyblock/getMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ module.exports = async function (query, options = { fetchPlayer: false, getMuseu
profile.cute_name,
new SkyblockMember({
uuid: query,
profileId: profile.profile_id,
profileName: profile.cute_name,
gameMode: profile.game_mode || null,
m: profile.members[query],
banking: profile.banking,
profileId: profile.profile_id,
communityUpgrades: profile.community_upgrades,
museum: options.getMuseum ? await getSkyblockMuseum.call(this, query, profile.profile_id) : null
museum: options.getMuseum ? await getSkyblockMuseum.call(this, query, profile.profile_id) : null,
selected: profile.selected
})
);
}
Expand Down
14 changes: 9 additions & 5 deletions src/API/skyblock/getProfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ module.exports = async function (query, options = { fetchPlayer: false, getMuseu
}

profiles.push({
profile_id: res.profiles[i].profile_id,
profile_name: res.profiles[i].cute_name,
members: res.profiles[i].members,
me: query,
uuid: query,
profileId: res.profiles[i].profile_id,
profileName: res.profiles[i].cute_name,
gameMode: res.profiles[i].game_mode || null,
m: res.profiles[i].members[query],
banking: res.profiles[i].banking,
communityUpgrades: res.profiles[i].community_upgrades,
museum: options.getMuseum ? await getSkyblockMuseum.call(this, query, res.profiles[i].profile_id) : null,
selected: res.profiles[i].selected,
museum: options.getMuseum ? await getSkyblockMuseum.call(this, query, res.profiles[i].profile_id) : null
members: res.profiles[i].members
});
}

Expand Down
27 changes: 25 additions & 2 deletions src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ class Client extends EventEmitter {
*/
async _makeRequest(options, url, useRateLimitManager = true) {
if (!url) return;
if (url !== '/key' && !options.noCacheCheck && (await this.requests.cache.has(url))) return Object.assign(await this.requests.cache.get(url), { raw: !!options.raw });
if (url !== '/key' && !options.noCacheCheck && (await this.requests.cache.has(url)))
return Object.assign(await this.requests.cache.get(url), { raw: !!options.raw });
if (useRateLimitManager) await rateLimit.rateLimitManager();
this.emit('outgoingRequest', url, { ...options, headers: { ...options.headers, ...this.options.headers } });
const result = await this.requests.request.call(this.requests, url, { ...options, headers: { ...options.headers, ...this.options.headers } });
const result = await this.requests.request.call(this.requests, url, {
...options,
headers: { ...options.headers, ...this.options.headers }
});
if (this.options.syncWithHeaders) rateLimit.sync(result._headers);
return result;
}
Expand Down Expand Up @@ -146,6 +150,11 @@ class Client extends EventEmitter {
* }).catch(e => {
* console.log(e);
* })
* @example
* // async/await
* const guild = await hypixel.getGuild('name', 'The Foundation').catch(console.log);
* console.log(guild.level); // 111
* console.log(guild.id); // '52e5719284ae51ed0c716c69'
*/
/**
* Allows you to get statistics of watchdog, the server anticheat
Expand All @@ -159,6 +168,10 @@ class Client extends EventEmitter {
* }).catch(e => {
* console.log(e);
* })
* @example
* // async/await
* const watchdog = await hypixel.getWatchdogStats().catch(console.log);
* console.log(watchdog.byWatchdogTotal); // 5931897
*/
/**
* Allows you to get all active boosters
Expand All @@ -172,6 +185,10 @@ class Client extends EventEmitter {
* }).catch(e => {
* console.log(e);
* })
* @example
* // async/await
* const boosters = await hypixel.getBoosters().catch(console.log);
* console.log(boosters[0].purchaser); // '978ddb705a8e43618e41749178c020b0'
*/
/**
* Allows you to get all skyblock profiles of player
Expand All @@ -186,6 +203,9 @@ class Client extends EventEmitter {
* }).catch(e => {
* console.log(e);
* })
* @example
* const profiles = await hypixel.getSkyblockProfiles('StavZDev').catch(console.log);
* console.log(profiles[0].members[0].uuid); // '52d9a36f66ce4cdf9a56ad9724ae9fb4'
*/
/**
* Allows you to get a player's skyblock member data from all their profiles
Expand All @@ -201,6 +221,9 @@ class Client extends EventEmitter {
* }).catch(e => {
* console.log(e);
* })
* @example
* const member = await hypixel.getSkyblockMember('StavZDev').catch(console.log);
* console.log(member.get('Cucumber').uuid); // '52d9a36f66ce4cdf9a56ad9724ae9fb4'
*/
/**
* Allows you to get a player's skyblock profile museum
Expand Down
Loading

0 comments on commit 75277bf

Please sign in to comment.