Skip to content

Commit 4bb66b7

Browse files
committed
Remove Small API Request
1 parent 33cfb3b commit 4bb66b7

File tree

5 files changed

+7
-33
lines changed

5 files changed

+7
-33
lines changed

API/functions/getLatestProfile.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,16 @@ async function getLatestProfile(uuid, options = { museum: false, garden: false }
2323
}
2424
}
2525

26-
const [{ data: playerRes }, { data: profileRes }] = await Promise.all([
27-
axios.get(`https://api.hypixel.net/v2/player?key=${config.minecraft.API.hypixelAPIkey}&uuid=${uuid}`),
26+
const [{ data: profileRes }] = await Promise.all([
2827
axios.get(`https://api.hypixel.net/v2/skyblock/profiles?key=${config.minecraft.API.hypixelAPIkey}&uuid=${uuid}`),
2928
]).catch((error) => {
3029
throw error?.response?.data?.cause ?? "Request to Hypixel API failed. Please try again!";
3130
});
3231

33-
if (playerRes.success === false || profileRes.success === false) {
32+
if (profileRes.success === false) {
3433
throw "Request to Hypixel API failed. Please try again!";
3534
}
3635

37-
if (playerRes.player == null) {
38-
throw "Player not found. It looks like this player has never joined the Hypixel.";
39-
}
40-
4136
if (profileRes.profiles == null || profileRes.profiles.length == 0) {
4237
throw "Player has no SkyBlock profiles.";
4338
}
@@ -57,7 +52,6 @@ async function getLatestProfile(uuid, options = { museum: false, garden: false }
5752
profiles: profileRes.profiles,
5853
profile: profile,
5954
profileData: profileData,
60-
playerRes: playerRes.player,
6155
uuid: uuid,
6256
...(options.museum ? await getMuseum(profileData.profile_id, uuid) : {}),
6357
...(options.garden ? await getGarden(profileData.profile_id) : {}),

API/stats/hotm.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,8 @@ const miningConst = require("../constants/mining.js");
44
const calcSkill = require("../constants/skills.js");
55
const moment = require("moment");
66

7-
module.exports = (player, profile) => {
7+
module.exports = (profile) => {
88
try {
9-
const commissions = {
10-
total: player?.achievements?.skyblock_hard_working_miner ?? 0,
11-
milestone: 0,
12-
};
13-
14-
// CREDITS: https://github.com/SkyCryptWebsite/SkyCrypt/blob/b9842bea6f1494fa2d2fd005b64f57d84646c188/src/stats/mining.js#L129
15-
if (profile.objectives?.tutorial !== undefined) {
16-
for (const key of profile.objectives.tutorial) {
17-
if (key.startsWith("commission_milestone_reward_mining_xp_tier_") === false) {
18-
continue;
19-
}
20-
21-
const tier = parseInt(key.slice(43));
22-
commissions.milestone = Math.max(commissions.milestone, tier);
23-
}
24-
}
25-
269
const forgeItems = [];
2710
if (profile.forge?.forge_processes?.forge_1) {
2811
const forge = Object.values(profile.forge.forge_processes.forge_1);
@@ -80,7 +63,6 @@ module.exports = (player, profile) => {
8063
},
8164
level: calcSkill("hotm", profile?.mining_core?.experience || 0),
8265
ability: titleCase(profile?.mining_core?.selected_pickaxe_ability || "none", true),
83-
commissions: commissions,
8466
forge: forgeItems,
8567
};
8668
} catch (error) {

src/minecraft/commands/forgeCommand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ForgeCommand extends minecraftCommand {
2727

2828
username = formatUsername(username, data.profileData?.game_mode);
2929

30-
const hotm = getHotm(data.playerRes, data.profile);
30+
const hotm = getHotm(data.profile);
3131

3232
if (hotm == null) {
3333
// eslint-disable-next-line no-throw-literal

src/minecraft/commands/hotmCommand.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class HotmCommand extends minecraftCommand {
2828

2929
username = formatUsername(username, data.profileData?.game_mode);
3030

31-
const hotm = getHotm(data.playerRes, data.profile);
31+
const hotm = getHotm(data.profile);
3232

3333
if (hotm == null) {
3434
// eslint-disable-next-line no-throw-literal
@@ -42,9 +42,7 @@ class HotmCommand extends minecraftCommand {
4242
hotm.powder.gemstone.total
4343
)} | Mithril Powder: ${formatNumber(hotm.powder.mithril.total)} | Glacite Powder: ${formatNumber(
4444
hotm.powder.glacite.total
45-
)} | Selected Ability: ${hotm.ability} | Commissions Milestone: ${
46-
hotm.commissions.milestone
47-
} (${hotm.commissions.total.toLocaleString()})`
45+
)} | Selected Ability: ${hotm.ability}`
4846
);
4947
} catch (error) {
5048
this.send(`/gc [ERROR] ${error}`);

src/minecraft/commands/skyblockCommand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SkyblockCommand extends minecraftCommand {
4141
}),
4242
getDungeons(data.profile),
4343
getTalismans(data.profile),
44-
getHotm(data.player, data.profile),
44+
getHotm(data.profile),
4545
]);
4646

4747
const skillAverage = (

0 commit comments

Comments
 (0)