Skip to content

Commit

Permalink
removed api key
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenga8533 committed Jan 1, 2024
1 parent 8ba713b commit 5bfc187
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 28 deletions.
3 changes: 2 additions & 1 deletion changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"- Changed warplist to dianalist",
"- Changed file pathing",
"- TODO: Recoded skill and powder? tracker",
"- Changed valuelist to only register held item"
"- Changed valuelist to only register held item",
"- Removed API key"
]
11 changes: 4 additions & 7 deletions features/combat/Bestiary.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,19 @@ import { data, registerWhen } from "../../utils/variables";
* Makes a PULL request to get bestiary data from the player's info using the Hypixel API.
*/
let bestiaryApi = undefined;
export function updateBestiary(profileId) {
if (settings.apiKey === "" || profileId === undefined) return;
function updateBestiary(profileId) {
if (profileId === undefined) return;

// Make an API request to Hypixel API to get the player's bestiary data from their profile.
request({
url: `https://api.hypixel.net/v2/skyblock/profile?key=${settings.apiKey}&profile=${profileId}`,
url: `https://api.hypixel.net/v2/skyblock/profile?key=4e927d63a1c34f71b56428b2320cbf95&profile=${profileId}`,
json: true
}).then((response) => {
// Update the 'bestiary' variable with the bestiary data from the API response.
bestiaryApi = response.profile.members[getPlayerUUID()]?.bestiary?.kills;
}).catch((err) => {
// If there is an error, display the error message in the Minecraft chat.
ChatLib.chat(`${LOGO + RED + err.cause ?? err}`);
if (err.cause === "Invalid API key") {
settings.apiKey = "";
ChatLib.chat(`${GREEN}API key cleared!`);
}
});
}
updateBestiary(data.lastID);
Expand Down Expand Up @@ -389,6 +385,7 @@ export function getBestiary(args) {
ChatLib.chat(`${LOGO + GOLD + BOLD + key}: ${GREEN}Needs ${RED + mob.next + GREEN} kills! (${RED + getTime(mob.nextTime) + GREEN})`);
break;
}
updateBestiary(data.lastID);
}


Expand Down
4 changes: 2 additions & 2 deletions features/crimsonIsle/TrophyCounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ function updateMessage(trophyVar) {
*
* @param {String} profileId - Profile ID of player.
*/
export function updateTrophy(profileId) {
function updateTrophy(profileId) {
if (settings.apiKey === "" || profileId === undefined) return;

// Make an API request to Hypixel API to get the player's bestiary data from their profile.
request({
url: `https://api.hypixel.net/v2/skyblock/profile?key=${settings.apiKey}&profile=${profileId}`,
url: `https://api.hypixel.net/v2/skyblock/profile?key=4e927d63a1c34f71b56428b2320cbf95&profile=${profileId}`,
json: true
}).then((response) => {
// Update the 'bestiary' variable with the bestiary data from the API response.
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function getHelp() {
ChatLib.chat(`${AQUA + BOLD}Settings: ${WHITE}/va ${GRAY}<${WHITE}gui, settings, toggles, version, help${GRAY}>`);
ChatLib.chat(`${AQUA + BOLD}Waypoints: ${WHITE}/va ${GRAY}<${WHITE}waypoint, enigma, npc, zone, cat${GRAY}>`);
ChatLib.chat(`${AQUA + BOLD}Lists: ${WHITE}/va ${GRAY}<${WHITE}cd, wl, bl, el, vl, dl, sl, il${GRAY}>`);
ChatLib.chat(`${AQUA + BOLD}Economy: ${WHITE}/va ${GRAY}<${WHITE}calc, attribute${GRAY}>`);
ChatLib.chat(`${AQUA + BOLD}Economy: ${WHITE}/va ${GRAY}<${WHITE}calc, attribute, nw${GRAY}>`);
ChatLib.chat(`${AQUA + BOLD}Misc: ${WHITE}/va ${GRAY}<${WHITE}splits, be${GRAY}>`);
ChatLib.chat(`${AQUA + BOLD}Etc: ${WHITE}/<sk, pesttp>\n`);

Expand Down
8 changes: 0 additions & 8 deletions utils/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ request({
});

// Event handler for detecting the player's profile ID from a chat message and update API data.
import { updateBestiary } from "../features/combat/Bestiary";
import { updateTrophy } from "../features/crimsonIsle/TrophyCounter";
let updatedTrophy = false;
register("chat", (id) => {
data.lastID = id;
updateBestiary(id);
if (!updatedTrophy) {
updateTrophy(id);
updatedTrophy = true;
}
}).setCriteria("Profile ID: ${id}");
9 changes: 0 additions & 9 deletions utils/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ ${ITALIC}Related Commands: /va <enigma, npc, zone>`);
// ████████████████████████████████████████████████████ GENERAL FEATURES ████████████████████████████████████████████████████

// --- Essential ---
@TextProperty({
name: "API Key",
description: `Input your API key ${BLUE}(only useful for "/va be")${GRAY}.\nYou may need to run ${AQUA}/ct load ${GRAY}after inputting key.`,
category: "General",
subcategory: "Essential",
protected: true
})
apiKey = "";
@SwitchProperty({
name: "Skyblock Toggle",
description: `Toggle ${GREEN}ON ${GRAY}for features to only function in Skyblock or ${RED}OFF ${GRAY}to function anywhere.`,
Expand Down

0 comments on commit 5bfc187

Please sign in to comment.