from bot import Bot from settings import AUTH, USERID, ROOMID bot = Bot(AUTH, USERID, ROOMID) #bot.debug = True def speak(data): if data['userid'] == '4deadb0f4fe7d013dc0555f1': if data['text'] == '/up': bot.addDj() elif data['text'] == '/down': bot.remDj() elif data['text'] == '/skip': bot.stopSong() elif data['text'] == '/snag': bot.snag() elif data['text'] == '/bop': bot.bop() elif data['text'] == '/playlist': def clb(data): print data bot.playlistAll(clb) def pmmed(data): print data bot.on('speak', speak) bot.on('pmmed', pmmed) bot.start()
bot = Bot(AUTH, USERID, ROOMID) theUsersList = { } def roomChanged(data): global theUsersList # Reset the users list theUsersList = {} users = data['users'] for user in users: theUsersList[user['userid']] = user def registered(data): global theUsersList user = data['user'][0] theUsersList[user['userid']] = user def deregistered(data): global theUsersList user = data['user'][0] del theUsersList[user['userid']] bot.on('roomChanged', roomChanged) bot.on('registered', registered) bot.on('deregistered', deregistered) bot.start()
# # Each time a song starts, the bot vote up. # WARNING: Turntable no longer allows bots that autobop. This script is provided for educational purposes only. # For more information, visit http://faq.turntable.fm/customer/portal/articles/258935 # from bot import Bot AUTH = "auth+live+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" USERID = "xxxxxxxxxxxxxxxxxxxxxxxx" ROOMID = "xxxxxxxxxxxxxxxxxxxxxxxx" bot = Bot(AUTH, USERID, ROOMID) def autobop(data): bot.bop() bot.on("newsong", autobop) bot.start()
# # Auto boot people on a blacklist. # from bot import Bot AUTH = 'auth+live+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' USERID = 'xxxxxxxxxxxxxxxxxxxxxxxx' ROOMID = 'xxxxxxxxxxxxxxxxxxxxxxxx' bot = Bot(AUTH, USERID, ROOMID) blackList = set(['xxxxxxxxxxxxxxxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxxxx']) # Someone enter the room, make sure he's not on the blacklist. def registered(data): global blackList user = data['user'][0] if user['userid'] in blackList: bot.boot(userId, 'You are on the blacklist.') bot.on('registered', registered) bot.start()