alaingilbert/Turntable-API — Issue #12: Bot stops being able to interact with the room after some time
Author: ZECTBynmo
Created: 2011-11-27 05:11:05+00:00
State: open

My bot works perfectly for about one minute, and then stops being able to interact with the room (vote, speak, etc...) all at once.

It hasn't frozen, because I still get console log messages that look perfect. I'm very confused.

Here's my code:

var Bot = require('ttapi');
var AUTH = 'auth+live+53781ac2f01396e4cfe1afb3c564b9fa771bee57';
var USERID = '4eca8214a3f751459f000b4a';
var ROOMID = '4e4460f314169c06532bc9c9';

var bot = new Bot(AUTH, USERID, ROOMID);

bot.on('speak', function (data) {
// Get the data
var name = data.name;
var text = data.text;

// Say stuff when someone says woofus
if ( text.indexOf("woofus") != -1 && !name.match(/^\woofus$/)) {
console.log('\nI heard my name\n\n', data);
bot.speak('/me woofus');
}
});

bot.on('newsong', function (data) {
bot.vote('up');
console.log('\New song, voted up\n\n', data);
});