aboutsummaryrefslogtreecommitdiff
path: root/build/cleaners
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-02-28 01:35:46 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-02-28 01:35:46 -0600
commit5bf261102017e6489af9b604a3a60cc8083c97d7 (patch)
treef1896edd1a44f5f09a7727f67b89a5295196f039 /build/cleaners
parentce7bd034cd5bd763c01674055ea88203bf806744 (diff)
parent3fb0c21c294a4ff02353e5726d5ef1c21c39cb0d (diff)
downloadskyblock-api-5bf261102017e6489af9b604a3a60cc8083c97d7.tar.gz
skyblock-api-5bf261102017e6489af9b604a3a60cc8083c97d7.tar.bz2
skyblock-api-5bf261102017e6489af9b604a3a60cc8083c97d7.zip
Merge branch 'main' of https://github.com/skyblockstats/skyblock-api into main
Diffstat (limited to 'build/cleaners')
-rw-r--r--build/cleaners/rank.js10
-rw-r--r--build/cleaners/skyblock/profile.js7
2 files changed, 10 insertions, 7 deletions
diff --git a/build/cleaners/rank.js b/build/cleaners/rank.js
index 2b8fb77..a9e5f35 100644
--- a/build/cleaners/rank.js
+++ b/build/cleaners/rank.js
@@ -25,10 +25,12 @@ function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusCo
name = colored.replace(/ยง./g, '').replace(/[\[\]]/g, '');
}
else {
- name = monthlyPackageRank
- || rank
- || (newPackageRank === null || newPackageRank === void 0 ? void 0 : newPackageRank.replace('_PLUS', '+'))
- || (packageRank === null || packageRank === void 0 ? void 0 : packageRank.replace('_PLUS', '+'));
+ if (monthlyPackageRank !== 'NONE')
+ name = monthlyPackageRank;
+ else
+ name = rank
+ || (newPackageRank === null || newPackageRank === void 0 ? void 0 : newPackageRank.replace('_PLUS', '+'))
+ || (packageRank === null || packageRank === void 0 ? void 0 : packageRank.replace('_PLUS', '+'));
// MVP++ is called Superstar for some reason
if (name === 'SUPERSTAR')
name = 'MVP++';
diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js
index fe1161e..3a6bc6f 100644
--- a/build/cleaners/skyblock/profile.js
+++ b/build/cleaners/skyblock/profile.js
@@ -26,13 +26,14 @@ exports.cleanSkyblockProfileResponseLighter = cleanSkyblockProfileResponseLighte
* This function is somewhat costly and shouldn't be called often. Use cleanSkyblockProfileResponseLighter if you don't need all the data
*/
async function cleanSkyblockProfileResponse(data, options) {
- const cleanedMembers = [];
+ // We use Promise.all so it can fetch all the users at once instead of waiting for the previous promise to complete
+ const promises = [];
for (const memberUUID in data.members) {
const memberRaw = data.members[memberUUID];
memberRaw.uuid = memberUUID;
- const member = await member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats', (options === null || options === void 0 ? void 0 : options.mainMemberUuid) === memberUUID ? 'inventories' : undefined]);
- cleanedMembers.push(member);
+ promises.push(member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats', (options === null || options === void 0 ? void 0 : options.mainMemberUuid) === memberUUID ? 'inventories' : undefined]));
}
+ const cleanedMembers = await Promise.all(promises);
const memberMinions = [];
for (const member of cleanedMembers) {
memberMinions.push(member.minions);