Merge branch 'master' of github.com:reality/depressionbot

This commit is contained in:
reality 2013-01-07 12:27:35 +00:00
commit 4c3887aa02
2 changed files with 28 additions and 1 deletions

View File

@ -48,10 +48,37 @@ var admin = function(dbot) {
exec("git submodule update", function (error, stdout, stderr) {
event.reply(dbot.t('gpull'));
commands.reload(event);
event.message = 'version';
event.action = 'PRIVMSG';
event.params = event.message.split(' ');
dbot.instance.emit(event);
}.bind(this));
}.bind(this));
},
// Display commit information for part of dbot
'version': function(event){
var cmd = "git log --pretty=format:'%h (%s): %ar' -n 1 -- ";
if(event.params[1]){
var input = event.params[1].trim();
if(dbot.modules.hasOwnProperty(input.split("/")[0])){
cmd += "modules/"+input;
}
else{
cmd += input;
}
}
exec(cmd, function(error, stdout, stderr){
if(stdout.length > 0){
event.reply(stdout);
}
else{
event.reply("No version information or queried module not loaded");
}
}.bind(this));
},
// Reload DB, translations and modules.
'reload': function(event) {
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));

@ -1 +1 @@
Subproject commit b8a3724739bdf8d9d7b53839b36bfb742f48d281
Subproject commit 0c9e207dd2f6dc6a65efef82bc48dd68d7a9fb18