3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

ignore certain commands for log [#556]

This commit is contained in:
reality 2013-08-18 17:42:23 +00:00
parent e5c51682fb
commit c513e8cd33
2 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,8 @@
var _ = require('underscore')._;
var log = function(dbot) {
this.ignoredCommands = [];
this.api = {
'log': function(server, user, message) {
var logChannel = this.config.logChannel[server];
@ -13,13 +15,17 @@ var log = function(dbot) {
'command': message,
'user': user
}));
},
'ignoreCommand': function(commandName) {
this.ignoredCommands.push(commandName);
}
};
this.onLoad = function() {
dbot.api.event.addHook('command', function(event) {
var logChannel = this.config.logChannel[event.server];
if(logChannel) {
if(logChannel && !_.include(this.ignoredCommands, command.split(' ')[0])) {
dbot.say(event.server, logChannel, dbot.t('log_message', {
'time': new Date().toUTCString(),
'command': event.message,

View File

@ -127,6 +127,10 @@ var webInterface = function(dbot) {
req.logout();
res.redirect('/');
});
if(_.has(dbot.modules, 'log')) {
dbot.api.log.ignoreCommand('~setwebpass');
}
}.bind(this);
this.onDestroy = function() {