forked from GitHub/dbot
c7124aa49e
This reverts commit 055ec14719
.
42 lines
977 B
JavaScript
42 lines
977 B
JavaScript
var logging = function(dbot) {
|
|
var logMessage = function(message) {
|
|
if(!(dbot.hasOwnProperty('log'))) {
|
|
dbot['log'] = [];
|
|
}
|
|
dbot.log.push([Date.now(), message]);
|
|
};
|
|
|
|
return {
|
|
'onLoad': function() {
|
|
logMessage({
|
|
'type': 'LoggerEvent',
|
|
'details': 'Logger loaded.'
|
|
});
|
|
|
|
return {};
|
|
},
|
|
|
|
'onDestroy': function() {
|
|
logMessage({
|
|
'type': 'LoggerEvent',
|
|
'details': 'Logger unloaded.'
|
|
});
|
|
},
|
|
|
|
'listener': function(data, eventType) {
|
|
logMessage({
|
|
'type': 'IRCEvent',
|
|
'details': {
|
|
'eventType': eventType,
|
|
'data': data
|
|
}
|
|
});
|
|
},
|
|
'on': ['JOIN', 'PART', 'KICK', 'PRIVMSG', 'MODE']
|
|
};
|
|
};
|
|
|
|
exports.fetch = function(dbot) {
|
|
return logging(dbot);
|
|
};
|