Advertisement
Guest User

Untitled

a guest
May 12th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. // For the cookie route, just set creds to the cookie value
  2. var creds = '...'; // Put the value of the connect.sid cookie here
  3.  
  4. // For username and password
  5. creds = {
  6. username: '...',
  7. password: '...'
  8. };
  9.  
  10. var bot = new DubtrackAPI(creds);
  11.  
  12. bot.connect('chillout-mixer'); // specify the room name part of the url for the room
  13.  
  14. bot.on('ready', function(data) {
  15. console.log("Ready to go: ", data);
  16. // data contains the currentDJ (by name) and currentTrack (artist and track), and the list of users in the room (does not update on join/depart)
  17.  
  18. bot.getEvents(function(events) {
  19. console.log("These are the Dubtrack events I respond to: ", events);
  20. });
  21. });
  22.  
  23. bot.on('chat-message', function(data) {
  24. console.log("got chat: ", data);
  25. });
  26.  
  27. bot.on('room_playlist-update', function(data) {
  28. console.log("new song playing: ", data);
  29. });
  30.  
  31. bot.on('error', function(msg, trace) {
  32. console.log("Got an error from the virtual browser: ", msg, trace);
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement