Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Script:
- setInterval(function(){
- connection.query("SELECT * FROM channels", function(error, rows, response, fields) {
- if (!!error) {
- console.log('Error in Query!');
- } else {
- console.log(rows);
- for(var i in rows) {
- console.log(rows[i].channels);
- $.getJSON('https://api.twitch.tv/kraken/streams/'+rows[i].channels+'?client_id=p45q4rdi1fxlyfsmfi6whncz8ns6wq', function(channel) {
- if (channel["stream"] != null) {
- console.log(''+channel["stream"]["channel"]["display_name"]+' is ONLINE');
- } else {
- $.getJSON('https://api.twitch.tv/kraken/channels/'+rows[i].channels+'?client_id=p45q4rdi1fxlyfsmfi6whncz8ns6wq', function(channel) {
- console.log(''+channel["display_name"]+' is OFFLINE');
- })}})}}});
- }, 5 * 1000);
- CMD:
- C:\Bot>node hm.js
- [ RowDataPacket { channels: 'APVideo', status: 'offline', rechte: 'test' },
- RowDataPacket { channels: 'murphystv', status: 'offline', rechte: 'fine' },
- RowDataPacket { channels: 'schnottling', status: 'offline', rechte: 'fine' } ]
- APVideo
- murphystv
- schnottling
- Schnottling is OFFLINE
- Schnottling is OFFLINE
- Schnottling is OFFLINE
- ^C
- C:\Bot>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement