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

bot.roomRegister does not set roomId #137

Open shawkattack opened 11 years ago

shawkattack commented 11 years ago

This is an easy but somewhat urgent fix.

Calling bot.roomRegister does not set the bot's roomId. This causes problems if, for example, you need to call bot.roomInfo later. The bot sends a null, and gets an error code in return from Turntable.

I discovered this issue by calling the bot constructor without a room ID, then calling roomRegister thinking it would handle this for me. Luckily, bot.roomId is publically available to change, so I have a temporary fix by inserting this line

bot.roomId = xxxxxxxxx;

before the call to roomRegister

alaingilbert commented 11 years ago

What version of ttapi do you use ?

var repl = require('repl');
var Bot = require('ttapi');
var bot = new Bot('XXXX', 'XXXX');
repl.start('> ').context.bot = bot;

Then...

> bot.roomId
null
> bot.roomRegister('4e6851fa14169c2255108b8c')
undefined
> bot.roomId
'4e6851fa14169c2255108b8c'
> bot.roomDeregister()
undefined
> bot.roomId
null
> bot.roomRegister('4e6851fa14169c2255108b8c')
undefined
> bot.roomId
'4e6851fa14169c2255108b8c'

Everything seems to work properly.

The latest version is 1.5.3.

shawkattack commented 11 years ago

I was using 1.5.3 since last night. I checked it again and it still breaks :/

MikeWills commented 11 years ago

I have been having issues on my android version of TT the past few days switching between rooms. Maybe the problem isn't in the API, but with TT itself.

Izzmo commented 11 years ago

Frick updated the API to fix the hole we found with sections. I wonder if the API call requires this now?