Created
November 20, 2021 10:17
-
-
Save zt3h/809b7bf5a98b851317dc50e13e89ef7f to your computer and use it in GitHub Desktop.
Code Example in JS for /networth/categories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
const getActiveProfile = function (profiles, uuid) { | |
return profiles.sort((a, b) => b.members[uuid].last_save - a.members[uuid].last_save)[0]; | |
}; | |
const getNetworth = async function (uuid, key) { | |
const { data } = await axios.get(`https://api.hypixel.net/skyblock/profiles?key=${key}&uuid=${uuid}`); | |
const activeProfile = getActiveProfile(data.profiles, uuid); | |
const profile = activeProfile.members[uuid]; | |
profile.banking = activeProfile.banking; | |
const response = await axios.post('https://nariah-dev.com/api/networth/categories', { data: profile }); | |
return response.data; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment