From 8d0f4ab608f3b02015ac96e211c30e2a53815687 Mon Sep 17 00:00:00 2001 From: SolarisFox Date: Mon, 18 May 2015 18:04:04 -0700 Subject: [PATCH] implement /forceban and /forcelock --- commands.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/commands.js b/commands.js index 824071c880..8227b0d5f9 100644 --- a/commands.js +++ b/commands.js @@ -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.");