diff --git a/src/schat.js b/src/schat.js index e9ff717..3937441 100755 --- a/src/schat.js +++ b/src/schat.js @@ -54,9 +54,12 @@ function onConnect(data, bot) { bot.socket.transmit('joinRooms', { rooms: config.channels }); } -function onRooms({ rooms, users }, bot) { +async function onRooms({ rooms }, bot) { logger.info(`Joined ${rooms.map((room) => room.name).join(', ')}`); + const usersRes = await bhttp.get(`${config.api}/room/${rooms.map((room) => room.id).join(',')}/users`); + const users = usersRes.body; + /* eslint-disable no-param-reassign */ bot.rooms = rooms.reduce((acc, room) => ({ ...acc, [room.id]: room }), {}); bot.users = { ...bot.users, ...users };