forked from GitHub/dbot
ignore certain commands for log [#556]
This commit is contained in:
parent
e5c51682fb
commit
c513e8cd33
@ -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,
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user