3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-26 04:32:37 +01:00
dbot/modules/log/log.js

25 lines
668 B
JavaScript
Raw Normal View History

2013-05-25 21:13:35 +02:00
/**
* Name: Log
* Description: Log commands to a channel.
*/
var _ = require('underscore')._;
var log = function(dbot) {
this.onLoad = function() {
dbot.api.event.addHook('command', function(event) {
var logChannel = this.config.logChannel[event.server];
if(logChannel) {
dbot.say(event.server, logChannel, dbot.t('log_message', {
'time': new Date().toUTCString(),
'command': event.message,
'user': event.user
}));
}
}.bind(this));
}.bind(this);
};
exports.fetch = function(dbot) {
return new log(dbot);
};