I’m new to the Twitch API and trying to make a discord bot which will make a notification when a streamer is live.
However instead of returning the json object of the specified streamer, it seems to grab the entire front page of Twitch, and it returns 65966 results instead of just 1.
const streamer = 'insertstreamerhere';
const api = `https://api.twitch.tv/kraken/streams?&user_login="${streamer}"`;
const announcements = bot.channels.find(`name`, "announcements");
snekfetch.get(api).set('Client-ID', "XXXXXXXXXXXXX").then(r => {
if (r.body.stream === null) {
setInterval(() => {
snekfetch.get(api).then(console.log(r.body))
}, 30000);
} else {
//Do other stuff console.log is temporary
console.log(r.body);
I’m not quite sure what I’m doing wrong, or if I’m misunderstanding the documentation.
Any clarification / insight is appreciated.
Thanks in advance