Check room exists before removing user.
This commit is contained in:
+3
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user