Skip to content

Commit

Permalink
Add unlogtext command
Browse files Browse the repository at this point in the history
The unlogtext command clears a banned user's messages from the chat logs, which is useful if they leaked something sensitive/private. This was partially suggested in the issues file under "Fixes to text hiding."
  • Loading branch information
team1257Simon committed Aug 3, 2016
1 parent 1daec1a commit 3148d26
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1892,6 +1892,34 @@ 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;
let userid = targetUser.getLastId();
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.");
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.add('|unlink|perma|' + userid);
if (userid !== toId(this.inputUsername)) this.add('|unlink|perma|' + toId(this.inputUsername));
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) {
Expand Down

0 comments on commit 3148d26

Please sign in to comment.