twitch-api-lite
Advanced tools
Comparing version 0.0.1 to 0.0.2
39
index.js
@@ -9,30 +9,27 @@ const request = require("request"); | ||
* @param clientID your twitch app client id | ||
* @param user_login the users stream url extension eg: twitch.tv/inflamesforever | ||
* @param streamerUsername the users stream url extension eg: twitch.tv/inflamesforever | ||
* @returns {Promise<Boolean>} | ||
*/ | ||
isTwitchUserLive(clientID, user_login) | ||
isTwitchUserLive(clientID, streamerUsername) | ||
{ | ||
return new Promise( | ||
function (fulfill, reject) | ||
return new Promise(function (fulfill, reject) | ||
{ | ||
try | ||
{ | ||
try | ||
request({ | ||
headers: { | ||
'Client-ID': clientID | ||
}, uri: 'https://api.twitch.tv/helix/streams?user_login=' + streamerUsername, method: 'GET' | ||
}, function (url, res, body) | ||
{ | ||
request({ | ||
headers: { | ||
'Client-ID': clientID | ||
}, | ||
uri: 'https://api.twitch.tv/helix/streams?user_login=' + user_login, | ||
method: 'GET' | ||
}, function (url, res, body) | ||
{ | ||
fulfill(JSON.parse(body).data.length !== 0) | ||
}) | ||
} | ||
catch (ex) | ||
{ | ||
reject(ex) | ||
} | ||
}) | ||
fulfill(JSON.parse(body).data.length !== 0) | ||
}) | ||
} | ||
catch (ex) | ||
{ | ||
reject(ex) | ||
} | ||
}) | ||
} | ||
}; |
{ | ||
"name": "twitch-api-lite", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "This package provides small lightweight functions that are to be used with the Twitch API v5", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
37615
30