-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unlogtext command #2645
Add unlogtext command #2645
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1892,6 +1892,24 @@ 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."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you permission checking again here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the "is the user banned" check. It's the same as the one in the hidetext command. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, but what's with the |
||
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) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not
!this.can("rangeban")
?