Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. Script:
  2. setInterval(function(){
  3. connection.query("SELECT * FROM channels", function(error, rows, response, fields) {
  4. if (!!error) {
  5. console.log('Error in Query!');
  6. } else {
  7. console.log(rows);
  8. for(var i in rows) {
  9. console.log(rows[i].channels);
  10. $.getJSON('https://api.twitch.tv/kraken/streams/'+rows[i].channels+'?client_id=p45q4rdi1fxlyfsmfi6whncz8ns6wq', function(channel) {
  11. if (channel["stream"] != null) {
  12. console.log(''+channel["stream"]["channel"]["display_name"]+' is ONLINE');
  13. } else {
  14. $.getJSON('https://api.twitch.tv/kraken/channels/'+rows[i].channels+'?client_id=p45q4rdi1fxlyfsmfi6whncz8ns6wq', function(channel) {
  15. console.log(''+channel["display_name"]+' is OFFLINE');
  16. })}})}}});
  17. }, 5 * 1000);
  18.  
  19. CMD:
  20. C:\Bot>node hm.js
  21. [ RowDataPacket { channels: 'APVideo', status: 'offline', rechte: 'test' },
  22. RowDataPacket { channels: 'murphystv', status: 'offline', rechte: 'fine' },
  23. RowDataPacket { channels: 'schnottling', status: 'offline', rechte: 'fine' } ]
  24.  
  25. APVideo
  26. murphystv
  27. schnottling
  28. Schnottling is OFFLINE
  29. Schnottling is OFFLINE
  30. Schnottling is OFFLINE
  31. ^C
  32. C:\Bot>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement