Merge pull request #1893 from SolarisFox/patch-1

Implement /forceban and /forcelock
This commit is contained in:
Guangcong Luo 2015-05-21 22:57:02 +00:00
commit 42ea92bc53

View File

@ -856,9 +856,10 @@ var commands = exports.commands = {
},
unmutehelp: ["/unmute [username] - Removes mute from user. Requires: % @ & ~"],
forcelock: 'lock',
l: 'lock',
ipmute: 'lock',
lock: function (target, room, user) {
lock: function (target, room, user, connection, cmd) {
if (!target) return this.parse('/help lock');
if ((user.locked || user.mutedRooms[room.id]) && !user.can('bypassall')) return this.sendReply("You cannot do this while unable to talk.");
@ -876,8 +877,14 @@ var commands = exports.commands = {
}
if (targetUser.confirmed) {
var from = targetUser.deconfirm();
ResourceMonitor.log("[CrisisMonitor] " + targetUser.name + " was locked by " + user.name + " and demoted from " + from.join(", ") + ".");
if (cmd === 'forcelock') {
var from = targetUser.deconfirm();
ResourceMonitor.log("[CrisisMonitor] " + targetUser.name + " was locked by " + user.name + " and demoted from " + from.join(", ") + ".");
} else {
return this.sendReply("" + targetUser.name + " is a confirmed user. If you are sure you would like to lock them use /forcelock.");
}
} else if (cmd === 'forcelock') {
return this.sendReply("Use /lock; " + targetUser.name + " is not a confirmed user.");
}
targetUser.popup("" + user.name + " has locked you from talking in chats, battles, and PMing regular users." + (target ? "\n\nReason: " + target : "") + "\n\nIf you feel that your lock was unjustified, you can still PM staff members (%, @, &, and ~) to discuss it" + (Config.appealurl ? " or you can appeal:\n" + Config.appealurl : ".") + "\n\nYour lock will expire in a few days.");
@ -914,8 +921,9 @@ var commands = exports.commands = {
},
unlockhelp: ["/unlock [username] - Unlocks the user. Requires: % @ & ~"],
forceban: 'ban',
b: 'ban',
ban: function (target, room, user) {
ban: function (target, room, user, connection, cmd) {
if (!target) return this.parse('/help ban');
if ((user.locked || user.mutedRooms[room.id]) && !user.can('bypassall')) return this.sendReply("You cannot do this while unable to talk.");
@ -933,8 +941,14 @@ var commands = exports.commands = {
}
if (targetUser.confirmed) {
var from = targetUser.deconfirm();
ResourceMonitor.log("[CrisisMonitor] " + targetUser.name + " was banned by " + user.name + " and demoted from " + from.join(", ") + ".");
if (cmd === 'forceban') {
var from = targetUser.deconfirm();
ResourceMonitor.log("[CrisisMonitor] " + targetUser.name + " was banned by " + user.name + " and demoted from " + from.join(", ") + ".");
} else {
return this.sendReply("" + targetUser.name + " is a confirmed user. If you are sure you would like to ban them use /forceban.");
}
} else if (cmd === 'forceban') {
return this.sendReply("Use /ban; " + targetUser.name + " is not a confirmed user.");
}
targetUser.popup("" + user.name + " has banned you." + (target ? "\n\nReason: " + target : "") + (Config.appealurl ? "\n\nIf you feel that your ban was unjustified, you can appeal:\n" + Config.appealurl : "") + "\n\nYour ban will expire in a few days.");