diff --git a/commands.js b/commands.js index 7f7be877b1097..517761b5b384c 100644 --- a/commands.js +++ b/commands.js @@ -1892,6 +1892,28 @@ exports.commands = { }, hidetexthelp: ["/hidetext [username] - Removes a locked or banned user's messages from chat (includes users banned from the room). Requires: % (global only), @ * # & ~"], + unlogtext: function (target, room, user) { + if (!target) return this.parse('/help unlogtext'); + this.splitTarget(target); + let targetUser = this.targetUser; + let name = this.targetUserName; + if (!user.can("rangeban")) { + this.errorReply("/unlogtext - Access denied."); + return false; + } + 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 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); + } + } + this.addModCommand("" + targetUser.name + "'s messages were deleted from the log in room " + room.id + " by " + user.name + "."); + }, + unlogtexthelp: ["/unlogtext [username] - Removes a locked or banned user's messages from chat and clears them from the room's log. Requires: & ~"], + banwords: 'banword', banword: { add: function (target, room, user) {