I began playing with js and I'm currently stuck with a problem I can't resolve by myself:
Here below is a small part of the code I have, I wait for a bot to start, then execute a function every minute. The problem I face is with the save of the data, indeed d always keep the value 0 and never get set to the json object I have as "data".
I am pretty new to js, please take it easy :)
var d = 0;
function bazar() {
fetch('https://api.hypixel.net/skyblock/bazaar')
.then(response => response.json())
.then(data => d = data);
setTimeout(() => bazar(), 60000);
}
client.on("ready", () =>
{
bazar();
console.debug(JSON.stringify(d));
});