diff --git a/commands.js b/commands.js index 517761b5b384c..ad956a82c8587 100644 --- a/commands.js +++ b/commands.js @@ -1903,12 +1903,15 @@ exports.commands = { } if (!targetUser) return this.errorReply("User '" + name + "' not found."); if (!(targetUser.locked || (room.bannedUsers[toId(name)] && room.bannedIps[targetUser.latestIp]) || user.can('rangeban'))) return this.errorReply("User '" + name + "' is not banned from this room or locked."); - for (let i = 0; i < room.log.length; i++) { + let i = 0; + while(i < room.log.length) { let message = room.log[i]; let split = message.split("|"); if (Users.get(split[3]) === this.targetUser || Users.get(split[3]).getAltUsers().indexOf(this.targetUser) >= 0) { room.log.splice(i, 1); + continue; } + i++; } this.addModCommand("" + targetUser.name + "'s messages were deleted from the log in room " + room.id + " by " + user.name + "."); },