dubtrackapi
dubtrackapi copied to clipboard
Running bot doesn't stay running
http://i.imgur.com/SjfPGCX.png
my bot.js file:
console.log('init');
var DubtrackAPI = require('./dubtrackapi');
// For the cookie route, just set creds to the cookie value
var creds = 'value of my cookie here'; // Put the value of the connect.sid cookie here
var bot = new DubtrackAPI(creds);
bot.connect('myroom'); // specify the room name part of the url for the room
console.log(bot);
bot.on('ready', function(data) {
console.log("Ready to go: ", data);
// 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)
bot.getEvents(function(events) {
console.log("These are the Dubtrack events I respond to: ", events);
});
});
bot.on('chat-message', function(data) {
console.log("got chat: ", data);
});
bot.on('room_playlist-update', function(data) {
console.log("new song playing: ", data);
});
bot.on('error', function(msg, trace) {
console.log("Got an error from the virtual browser: ", msg, trace);
});
In the same directory I have the dubtrackapi.js file.
after running node bot.js, it runs, echo's my "init" I have, and kicks me out to my prompt without any errors. Any idea what's going on?
Any help would be appreciated. Thanks!
It seems to be failing around the createPage around line 259
try {
phantom.create(function(error,ph) {
ph.get('version', function(result) {
if(result.major < 2) {
var version = result.major + "." + result.minor + "." + result.patch;
console.log("Sorry, but PlugBotAPI requires phantomjs version >= 2.0.0. You are running version " + version + ".");
ph.exit();
process.exit(1);
}
});
if(typeof callback == 'function') callback(ph);
});
} catch (err){ console.log('DubtrackAPI.createPage error: '+err) }
After wrapping it in a catch, I get this error : TypeError: args.concat is not a function