diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-13 16:28:26 -0600 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-13 16:28:26 -0600 |
commit | 5c9ef89af1ee9af380ea82072a3a48d5db0f2c7a (patch) | |
tree | 8d3f2fc286a7f18931b1d561cf376b897e8f6d18 /build/cleaners/skyblock/profile.js | |
parent | dd513537e240bbaf12c4f204d49db88111633d98 (diff) | |
download | skyblock-api-5c9ef89af1ee9af380ea82072a3a48d5db0f2c7a.tar.gz skyblock-api-5c9ef89af1ee9af380ea82072a3a48d5db0f2c7a.tar.bz2 skyblock-api-5c9ef89af1ee9af380ea82072a3a48d5db0f2c7a.zip |
move some code to make more sense
Diffstat (limited to 'build/cleaners/skyblock/profile.js')
-rw-r--r-- | build/cleaners/skyblock/profile.js | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js index 86e21a3..5804bb5 100644 --- a/build/cleaners/skyblock/profile.js +++ b/build/cleaners/skyblock/profile.js @@ -1,28 +1,8 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.fetchMemberProfile = exports.cleanSkyblockProfileResponse = exports.cleanSkyblockProfileResponseLighter = void 0; +exports.cleanSkyblockProfileResponse = exports.cleanSkyblockProfileResponseLighter = void 0; const member_1 = require("./member"); const minions_1 = require("./minions"); -const cached = __importStar(require("../../hypixelCached")); const bank_1 = require("./bank"); /** Return a `CleanProfile` instead of a `CleanFullProfile`, useful when we need to get members but don't want to waste much ram */ async function cleanSkyblockProfileResponseLighter(data) { @@ -62,38 +42,8 @@ async function cleanSkyblockProfileResponse(data) { name: data.cute_name, members: cleanedMembers, bank: bank_1.cleanBank(data), - minions + minions: minions, + minion_count: minions_1.countUniqueMinions(minions) }; } exports.cleanSkyblockProfileResponse = cleanSkyblockProfileResponse; -// TODO: this should be moved and split up -/** - * Fetch a CleanMemberProfile from a user and string - * This is safe to use many times as the results are cached! - * @param user A username or uuid - * @param profile A profile name or profile uuid - */ -async function fetchMemberProfile(user, profile) { - const playerUuid = await cached.uuidFromUser(user); - const profileUuid = await cached.fetchProfileUuid(user, profile); - const player = await cached.fetchPlayer(playerUuid); - const cleanProfile = await cached.fetchProfile(playerUuid, profileUuid); - const member = cleanProfile.members.find(m => m.uuid === playerUuid); - return { - member: { - // the profile name is in member rather than profile since they sometimes differ for each member - profileName: cleanProfile.name, - first_join: member.first_join, - last_save: member.last_save, - // add all other data relating to the hypixel player, such as username, rank, etc - ...player - }, - profile: { - uuid: cleanProfile.uuid, - bank: cleanProfile.bank, - minions: cleanProfile.minions, - minion_count: minions_1.countUniqueMinions(cleanProfile.minions) - } - }; -} -exports.fetchMemberProfile = fetchMemberProfile; |