mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +01:00
ignore certain commands for log [#556]
This commit is contained in:
parent
e5c51682fb
commit
c513e8cd33
@ -5,6 +5,8 @@
|
|||||||
var _ = require('underscore')._;
|
var _ = require('underscore')._;
|
||||||
|
|
||||||
var log = function(dbot) {
|
var log = function(dbot) {
|
||||||
|
this.ignoredCommands = [];
|
||||||
|
|
||||||
this.api = {
|
this.api = {
|
||||||
'log': function(server, user, message) {
|
'log': function(server, user, message) {
|
||||||
var logChannel = this.config.logChannel[server];
|
var logChannel = this.config.logChannel[server];
|
||||||
@ -13,13 +15,17 @@ var log = function(dbot) {
|
|||||||
'command': message,
|
'command': message,
|
||||||
'user': user
|
'user': user
|
||||||
}));
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
'ignoreCommand': function(commandName) {
|
||||||
|
this.ignoredCommands.push(commandName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onLoad = function() {
|
this.onLoad = function() {
|
||||||
dbot.api.event.addHook('command', function(event) {
|
dbot.api.event.addHook('command', function(event) {
|
||||||
var logChannel = this.config.logChannel[event.server];
|
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', {
|
dbot.say(event.server, logChannel, dbot.t('log_message', {
|
||||||
'time': new Date().toUTCString(),
|
'time': new Date().toUTCString(),
|
||||||
'command': event.message,
|
'command': event.message,
|
||||||
|
@ -127,6 +127,10 @@ var webInterface = function(dbot) {
|
|||||||
req.logout();
|
req.logout();
|
||||||
res.redirect('/');
|
res.redirect('/');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(_.has(dbot.modules, 'log')) {
|
||||||
|
dbot.api.log.ignoreCommand('~setwebpass');
|
||||||
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
this.onDestroy = function() {
|
this.onDestroy = function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user