Ok, like the title i don't know i can do this. I have to open a url where there is json code and store it in a variable. I tried this way that I found here:
module.exports.run = async (bot, message, args) => {
let url = "my link"
snekfetch.get(url).then(r =>
message.channel.send(decodeURIComponent(r.body)));
}
But this doesn't work.
Now I tried this code:
const fetch = require('node-fetch');
fetch(userUrl)
.then(res => res.json())
.then(json => console.log(json));
};
And I got this: console log
How can I i take those object and store them value in an variable?
I've solved it: The function
async function takeXpVerification(userUrl){
return await fetch(userUrl)
.then(res => res.json())
}
Where i call it for get the value
getAfterCurrentXp = await takeXpVerification(userUrl);
getAfterCurrentXp = getAfterCurrentXp["profile"]["experience"];