mirror of
https://github.com/reality/dbot.git
synced 2024-11-30 16:09:27 +01:00
Vaguely functional now. Will work on more later.
This commit is contained in:
parent
3f218ebb52
commit
055ec14719
@ -1,9 +1,19 @@
|
||||
var logging = function(dbot) {
|
||||
var logMessage = function(message) {
|
||||
var logMessage = function(message, channel) {
|
||||
if(!(dbot.hasOwnProperty('log'))) {
|
||||
dbot['log'] = [];
|
||||
dbot['log'] = {};
|
||||
}
|
||||
dbot.log.push([Date.now(), message]);
|
||||
|
||||
if(channel) {
|
||||
channel = channel.toLowerCase();
|
||||
} else {
|
||||
channel = '@'; // it's a logger message, shouldn't go in any channel. hence, invalid channel name '@'
|
||||
}
|
||||
|
||||
if(!(dbot.log.hasOwnProperty(channel))) {
|
||||
dbot.log[channel] = [];
|
||||
}
|
||||
dbot.log[channel].push([Date.now(), message]);
|
||||
};
|
||||
|
||||
return {
|
||||
@ -30,7 +40,7 @@ var logging = function(dbot) {
|
||||
'eventType': eventType,
|
||||
'data': data
|
||||
}
|
||||
});
|
||||
}, data.channel);
|
||||
},
|
||||
'on': ['JOIN', 'PART', 'KICK', 'PRIVMSG', 'MODE']
|
||||
};
|
||||
|
@ -18,7 +18,12 @@ var webInterface = function(dbot) {
|
||||
|
||||
// Displays any logs collected by the logging module
|
||||
app.get('/log', function(req, res) {
|
||||
res.render('log', { 'name': dbot.name, 'log': (dbot.log || []) });
|
||||
res.redirect('/log/identicurse');
|
||||
});
|
||||
|
||||
app.get('/log/:channel', function(req, res) {
|
||||
var channel = '#' + req.params.channel.toLowerCase();
|
||||
res.render('log', { 'name': dbot.name, 'log': (dbot.log[channel] || []), 'channel': channel });
|
||||
});
|
||||
|
||||
// Lists the quote categories
|
||||
|
Loading…
Reference in New Issue
Block a user