2013-01-22 21:44:45 +01:00
|
|
|
var _ = require('underscore')._;
|
|
|
|
|
|
|
|
var commands = function(dbot){
|
2013-01-23 23:55:06 +01:00
|
|
|
var cmds = {
|
2013-01-22 21:44:45 +01:00
|
|
|
|
|
|
|
"~test_getprop": function(event){
|
|
|
|
if(event.params[1]){
|
|
|
|
var res = dbot.db.profiles[event.server][event.user.toLowerCase()].profile[event.params[1]];
|
|
|
|
if(res){
|
|
|
|
event.reply(res);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
event.reply("Nope.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
"~test_setprop": function(event){
|
2013-01-23 23:55:06 +01:00
|
|
|
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];
|
2013-01-23 20:13:10 +01:00
|
|
|
event.reply("Property set, maybe?");
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
event.reply("Invalid property. Go home.");
|
|
|
|
}
|
2013-01-22 21:44:45 +01:00
|
|
|
}
|
|
|
|
}
|
2013-01-23 23:55:06 +01:00
|
|
|
};
|
|
|
|
cmds['~test_setprop'].regex = [/~test_setprop ([^ ]+) (.+)/, 3];
|
|
|
|
|
|
|
|
return cmds;
|
2013-01-22 21:44:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.fetch = function(dbot){
|
|
|
|
return commands(dbot);
|
|
|
|
};
|