mirror of
https://github.com/reality/dbot.git
synced 2024-11-30 16:09:27 +01:00
Merge pull request #108 from SamStudio8/master
version command [Close #96]
This commit is contained in:
commit
b7ac12ecc2
@ -50,6 +50,34 @@ var admin = function(dbot) {
|
|||||||
commands.reload(event);
|
commands.reload(event);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
event.message = 'version';
|
||||||
|
event.action = 'PRIVMSG';
|
||||||
|
event.params = event.message.split(' ');
|
||||||
|
dbot.instance.emit(event);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 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 DB, translations and modules.
|
||||||
|
Loading…
Reference in New Issue
Block a user