mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
reinstate ~profile command
This commit is contained in:
parent
dd64b5955a
commit
72200596de
@ -2,32 +2,34 @@ var _ = require('underscore')._;
|
|||||||
|
|
||||||
var commands = function(dbot){
|
var commands = function(dbot){
|
||||||
var commands = {
|
var commands = {
|
||||||
|
'~getprop': function(event){
|
||||||
"~getprop": function(event){
|
|
||||||
if(event.params[1]){
|
if(event.params[1]){
|
||||||
if(_.has(this.config.schema.profile, event.params[1])){
|
if(_.has(this.config.schema.profile, event.params[1])){
|
||||||
this.api.getProperty(event.server, event.user, event.params[1], function(reply){
|
this.api.getProperty(event.server, event.user, event.params[1], function(reply){
|
||||||
event.reply(reply);
|
event.reply(reply);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
event.reply('Invalid property. Go home.');
|
||||||
event.reply("Invalid property. Go home.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"~setprop": function(event){
|
'~setprop': function(event){
|
||||||
if(event.input[1] && event.input[2]){
|
if(event.input[1] && event.input[2]){
|
||||||
if(_.has(this.config.schema.profile, event.input[1])){
|
if(_.has(this.config.schema.profile, event.input[1])){
|
||||||
this.api.setProperty(event.server, event.user, event.input[1], event.input[2], function(reply){
|
this.api.setProperty(event.server, event.user, event.input[1], event.input[2], function(reply){
|
||||||
event.reply(reply);
|
event.reply(reply);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
event.reply('Invalid property. Go home.');
|
||||||
event.reply("Invalid property. Go home.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'~profile': function(event) {
|
||||||
|
var user = event.params[1] || event.user;
|
||||||
|
event.reply(dbot.api.web.getUrl('profile/' + event.server + '/' + user));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
commands['~setprop'].regex = [/~setprop ([^ ]+) (.+)/, 3];
|
commands['~setprop'].regex = [/~setprop ([^ ]+) (.+)/, 3];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user