From 5bfc1878ecd09da773e0ee2e827aca6fe33df8b5 Mon Sep 17 00:00:00 2001 From: Allen Zheng Date: Mon, 1 Jan 2024 11:27:03 -0500 Subject: [PATCH] removed api key --- changelog.json | 3 ++- features/combat/Bestiary.js | 11 ++++------- features/crimsonIsle/TrophyCounter.js | 4 ++-- index.js | 2 +- utils/player.js | 8 -------- utils/settings.js | 9 --------- 6 files changed, 9 insertions(+), 28 deletions(-) diff --git a/changelog.json b/changelog.json index d2ebeed2..9a8a792d 100644 --- a/changelog.json +++ b/changelog.json @@ -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" ] \ No newline at end of file diff --git a/features/combat/Bestiary.js b/features/combat/Bestiary.js index 9d998639..776cbb5d 100644 --- a/features/combat/Bestiary.js +++ b/features/combat/Bestiary.js @@ -11,12 +11,12 @@ 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. @@ -24,10 +24,6 @@ export function updateBestiary(profileId) { }).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); @@ -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); } diff --git a/features/crimsonIsle/TrophyCounter.js b/features/crimsonIsle/TrophyCounter.js index 5939b91e..1b70d08b 100644 --- a/features/crimsonIsle/TrophyCounter.js +++ b/features/crimsonIsle/TrophyCounter.js @@ -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. diff --git a/index.js b/index.js index 293ef6d4..d9cb04c8 100644 --- a/index.js +++ b/index.js @@ -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}/\n`); diff --git a/utils/player.js b/utils/player.js index 97de3526..0e60fa67 100644 --- a/utils/player.js +++ b/utils/player.js @@ -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}"); diff --git a/utils/settings.js b/utils/settings.js index eeae7aa4..504f3f11 100644 --- a/utils/settings.js +++ b/utils/settings.js @@ -86,15 +86,6 @@ ${ITALIC}Related Commands: /va `); // ████████████████████████████████████████████████████ 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.`,