Closed kgleason closed 11 years ago
Hi ! This question is at the very right place :) Basically, every call made to turntable.fm are async and need a callback if you want to do something with the result. So you are right, the documentation says that the callback is optional, but, if you don't have a callback, the "roomInfo" call become kinda useless. (Which mean, I should probably fix the documentation !)
from ttapi import Bot
bot = Bot(AUTH, USERID, ROOMID)
def roomInfo(data):
print data
def roomChanged(data):
print 'data:', data
bot.roomInfo(roomInfo)
bot.on('roomChanged', roomChanged)
bot.start()
from ttapi import Bot
bot = Bot(AUTH, USERID, ROOMID)
def roomChanged(data):
def roomInfo(data2):
print data2
print 'data:', data
bot.roomInfo(roomInfo)
bot.on('roomChanged', roomChanged)
bot.start()
I think that both example should work properly.
Thanks. There are a couple of these that I've noticed, so I might just submit a pull request for the documentation, but it probably won't be until later in the week. Thanks for the speedy response.
^make sure you close the issue once it solves your question, kgleason
@kgleason Don't be shy to open a pull request :D
I apologize for this if is not the right place for this question. I've managed to get quite a bit done already with the Python version of the ttapi, but I'm stuck on the bot.roomInfo().
Here is a sample of what I'm trying to do:
so when I fire this off, my bot connects, and get output that looks like this:
If I'm reading the docs properly, I was expecting to see data2 to look similar to data.
According to the docs, it looks as if the callback function isn't required; but the only way I ever get results from bot.roomInfo is if I actually use a callback function.
If I'm reading it all wrong, then I sincerely apologize.