Accessing Individual Data
Luxorium opened this issue · comments
Hi, I don't know if this is where I put this message, but I need help. I'm making a Discord bot and I'd love to use your package. But, how do I access the data individually? Could you make the results of "fortnite.user" into a variable and use objects to reference them? For example, "data.stats.solo.kills" could reference the amount of solo kills the given user has. If this is already a thing, please tell me how to reference in my code. If you need further information, please tell me and I'll get you anything you need to know.
Look up JS promises and how they work. The code snippet below is how you use what is returned from a method that returns a promise.
fortnite.user('Ninja', 'pc').then(data => {
// data is the variable with the user data in it
console.log(data);
let soloKills = data.stats.solo.kills;
});