missing log and custom log messages [close #555]

This commit is contained in:
reality 2013-08-18 16:37:30 +00:00
parent 403fd035a7
commit 930ca1fbc0
3 changed files with 17 additions and 1 deletions

View File

@ -5,6 +5,17 @@
var _ = require('underscore')._; var _ = require('underscore')._;
var log = function(dbot) { var log = function(dbot) {
this.api = {
'log': function(server, user, message) {
var logChannel = this.config.logChannel[event.server];
dbot.say(server, logChannel, dbot.t('log_message', {
'time': new Date().toUTCString(),
'command': message,
'user': user
}));
}
};
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];

View File

@ -28,6 +28,11 @@ var pages = function(dbot) {
'user': user.primaryNick, 'user': user.primaryNick,
'notifies': notifies 'notifies': notifies
}); });
if(_.has(dbot.modules, 'log')) {
dbot.api.log.log(server, user.primaryNick,
'Checked their missing notifications.');
}
}, },
'/report/:server/:channel': function(req, res) { '/report/:server/:channel': function(req, res) {

View File

@ -219,7 +219,7 @@ var users = function(dbot) {
} }
}.bind(this)); }.bind(this));
}.bind(this), function(err) { }.bind(this), function(err) {
console.log('finished checking ' + channel); console.log('Finished checking ' + channel.name);
}); });
}.bind(this); }.bind(this);