Merge pull request #199 from SamStudio8/master

Regex for ~test_setprop
This commit is contained in:
Sam Nicholls 2013-01-23 14:55:47 -08:00
commit 1d0a5cb8a5

View File

@ -1,7 +1,7 @@
var _ = require('underscore')._; var _ = require('underscore')._;
var commands = function(dbot){ var commands = function(dbot){
return { var cmds = {
"~test_getprop": function(event){ "~test_getprop": function(event){
if(event.params[1]){ if(event.params[1]){
@ -16,9 +16,9 @@ var commands = function(dbot){
}, },
"~test_setprop": function(event){ "~test_setprop": function(event){
if(event.params[1] && event.params[2]){ if(event.input[1] && event.input[2]){
if(_.has(this.config.schema.profile, event.params[1])){ if(_.has(this.config.schema.profile, event.input[1])){
dbot.db.profiles[event.server][event.user.toLowerCase()].profile[event.params[1]] = event.params[2]; dbot.db.profiles[event.server][event.user.toLowerCase()].profile[event.input[1]] = event.input[2];
event.reply("Property set, maybe?"); event.reply("Property set, maybe?");
} }
else{ else{
@ -26,7 +26,10 @@ var commands = function(dbot){
} }
} }
} }
} };
cmds['~test_setprop'].regex = [/~test_setprop ([^ ]+) (.+)/, 3];
return cmds;
}; };
exports.fetch = function(dbot){ exports.fetch = function(dbot){