Check room exists before removing user.

This commit is contained in:
2021-11-08 02:48:26 +01:00
parent 5336070245
commit 2a9311f021
2 changed files with 7 additions and 6 deletions
+3 -1
View File
@@ -123,7 +123,9 @@ function onJoin(data, bot) {
}
function onLeave(data, bot) {
bot.rooms[data.roomId].users = bot.rooms[data.roomId].users.filter((userId) => userId !== data.userId);
if (bot.rooms[data.roomId]) {
bot.rooms[data.roomId].users = bot.rooms[data.roomId].users.filter((userId) => userId !== data.userId);
}
}
function onMessage(message, bot, games) {