Closed mnafricano closed 11 years ago
var bot = new Bot(AUTH, USERID);
bot.on('ready', function () {
bot.listRooms(0, function (data) {
for (var i=0; i<data.rooms.length; i++) {
var room = data.rooms[i];
var listeners = room.metadata.listeners;
if (listeners > 5) {
bot.roomRegister(room.roomid);
}
}
});
});
By the way, I think that listRooms
return the most popular rooms first. So your bot will always register in the first room.
var bot = new Bot(AUTH, USERID);
bot.on('ready', function () {
bot.listRooms(0, function (data) {
bot.roomRegister(data.rooms[0].roomid);
});
});
Awesome, great help! Thanks a ton, I really appreciate it.
If I was to make a bot that goes to a room and leaves if there aren't enough listeners, what would I do to have the bot be able to see the rooms, go to one, then leave if it doesn't have enough listeners. Here is the code I have so far:
Thanks you for your time and your help, it's very appreciated.