From 2a59f20b608251bcfea77bb3004567234d424737 Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Wed, 23 Jan 2013 22:55:06 +0000 Subject: [PATCH] Regex for ~test_setprop --- modules/profile/commands.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/profile/commands.js b/modules/profile/commands.js index d92a4f4..d7088c0 100644 --- a/modules/profile/commands.js +++ b/modules/profile/commands.js @@ -1,7 +1,7 @@ var _ = require('underscore')._; var commands = function(dbot){ - return { + var cmds = { "~test_getprop": function(event){ if(event.params[1]){ @@ -16,9 +16,9 @@ var commands = function(dbot){ }, "~test_setprop": function(event){ - if(event.params[1] && event.params[2]){ - if(_.has(this.config.schema.profile, event.params[1])){ - dbot.db.profiles[event.server][event.user.toLowerCase()].profile[event.params[1]] = event.params[2]; + if(event.input[1] && event.input[2]){ + if(_.has(this.config.schema.profile, event.input[1])){ + dbot.db.profiles[event.server][event.user.toLowerCase()].profile[event.input[1]] = event.input[2]; event.reply("Property set, maybe?"); } else{ @@ -26,7 +26,10 @@ var commands = function(dbot){ } } } - } + }; + cmds['~test_setprop'].regex = [/~test_setprop ([^ ]+) (.+)/, 3]; + + return cmds; }; exports.fetch = function(dbot){