Only adding users to known rooms.

This commit is contained in:
2021-11-06 02:14:33 +01:00
parent c4f448ea12
commit 114555be66
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -116,9 +116,8 @@ function onRooms({ rooms, users }, bot) {
/* eslint-disable no-param-reassign */
function onJoin(data, bot) {
bot.users[data.user.id] = data.user;
if (!bot.rooms[data.roomId].includes(data.user.id)) {
if (bot.rooms[data.roomId] && !bot.rooms[data.roomId]?.includes(data.user.id)) {
bot.users[data.user.id] = data.user;
bot.rooms[data.roomId].push(data.user.id);
}
}