Merge pull request #1673 from matrix-org/t3chguy/fix_op_slashcommand_for_negatives

Allow argument to op slashcommand to be negative as PLs can be -ve
This commit is contained in:
David Baker 2018-01-05 11:28:52 +00:00 committed by GitHub
commit 242d84c63a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -295,7 +295,7 @@ const commands = {
// Define the power level of a user // Define the power level of a user
op: new Command("op", "<userId> [<power level>]", function(roomId, args) { op: new Command("op", "<userId> [<power level>]", function(roomId, args) {
if (args) { if (args) {
const matches = args.match(/^(\S+?)( +(\d+))?$/); const matches = args.match(/^(\S+?)( +(-?\d+))?$/);
let powerLevel = 50; // default power level for op let powerLevel = 50; // default power level for op
if (matches) { if (matches) {
const userId = matches[1]; const userId = matches[1];