3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 03:33:07 +01:00
dbot/modules/profile/commands.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

var _ = require('underscore')._;
var commands = function(dbot){
var commands = {
"~getprop": function(event){
if(event.params[1]){
if(_.has(this.config.schema.profile, event.params[1])){
this.api.getProperty(event.server, event.user, event.params[1], function(reply){
event.reply(reply);
});
}
else{
event.reply("Invalid property. Go home.");
}
}
},
"~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])){
this.api.setProperty(event.server, event.user, event.input[1], event.input[2], function(reply){
event.reply(reply);
});
2013-01-23 20:13:10 +01:00
}
else{
event.reply("Invalid property. Go home.");
}
}
2013-01-25 20:57:04 +01:00
},
2013-01-23 23:55:06 +01:00
};
commands['~setprop'].regex = [/~setprop ([^ ]+) (.+)/, 3];
2013-01-23 23:55:06 +01:00
return commands;
};
exports.fetch = function(dbot){
return commands(dbot);
};