alaingilbert / Turntable-API

Allows you to create bots for turntable.fm
http://alaingilbert.github.com/Turntable-API/
MIT License
317 stars 98 forks source link

Hello command #166

Closed ghost closed 11 years ago

ghost commented 11 years ago

My bot is not saying Hey, How are you when you do the hello command.

alaingilbert commented 11 years ago

ok... what is your code... ? Do you get any error ?

ghost commented 11 years ago

no, he just won't respond.

var Bot    = require('ttapi');
var AUTH   = 'xxx';
var USERID = 'xxx';
var ROOMID = 'xxx';

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

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

  // Respond to "/hello" command
  if (text.match(/^\/hello$/)) {
    bot.speak('Hey! How are you @'+name+'?');
  }
});
alaingilbert commented 11 years ago

You can see him in the room ? Have you installed "ttapi" with npm ?

ghost commented 11 years ago

i can see him in the room and i installed ttapi with npm.

alaingilbert commented 11 years ago

If you do :

bot.on('speak', function (data) {
  console.log("--- TEST ---");
  console.log(data, data.text == '/hello');
});

Can you see the --- TEST --- in the terminal ? If yes, what's the complete output ?

ghost commented 11 years ago

no

alaingilbert commented 11 years ago

I mean, you have to write something in the chat... then it should appear in the terminal.

ghost commented 11 years ago

ok

ghost commented 11 years ago

it started working again after I refreshed the bot