[NodeJS + tmi.js] Error

Hi, i dev actually my bot (discord/twitch) but i block on a request:

strong textclient.api({
url: “https://api.twitch.tv/kraken/channels/MY_CHANNEL_ID/follows?api_version=5”,
method: “GET”,
headers: {
“Client-ID”: “CLIENT_KEY”
}
}, function(err, res, body) {
console.log(body);
});

That code return =>

{ _total: 240,
_links:
{ self: ‘https://api.twitch.tv/kraken/channels/zehnovh/follows?channel=zehnovh&direction=desc&limit=1’,
next: ‘https://api.twitch.tv/kraken/channels/zehnovh/follows?channel=zehnovh&cursor=1542165100434341275&direction=desc&limit=1’ },
_cursor: ‘1542165100434341275’,
follows:
[ { created_at: ‘2018-11-14T03:11:40Z’,
_links: [Object],
notifications: true,
user: [Object] } ] }

How i can var my user: [Object] ? Thanks alot.

console.log doesn’t “deep expand” the entries.

Something like a basic loop:

}, function(err, res, body) {
for (var x=0;x<body.follows.length;x++) {
    console.log(body.follows[x]);
}
});

Will show the keys/data in the object

Thanks, but i was use another way (i use GET fonction with xmlhttprequest) ! But you rox Barry :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.