mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 20:22:39 +01:00
Revert "Vaguely functional now. Will work on more later."
This reverts commit 055ec14719
.
This commit is contained in:
parent
1503ad4ed5
commit
c7124aa49e
@ -1,19 +1,9 @@
|
|||||||
var logging = function(dbot) {
|
var logging = function(dbot) {
|
||||||
var logMessage = function(message, channel) {
|
var logMessage = function(message) {
|
||||||
if(!(dbot.hasOwnProperty('log'))) {
|
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 {
|
return {
|
||||||
@ -40,7 +30,7 @@ var logging = function(dbot) {
|
|||||||
'eventType': eventType,
|
'eventType': eventType,
|
||||||
'data': data
|
'data': data
|
||||||
}
|
}
|
||||||
}, data.channel);
|
});
|
||||||
},
|
},
|
||||||
'on': ['JOIN', 'PART', 'KICK', 'PRIVMSG', 'MODE']
|
'on': ['JOIN', 'PART', 'KICK', 'PRIVMSG', 'MODE']
|
||||||
};
|
};
|
||||||
|
@ -18,12 +18,7 @@ var webInterface = function(dbot) {
|
|||||||
|
|
||||||
// Displays any logs collected by the logging module
|
// Displays any logs collected by the logging module
|
||||||
app.get('/log', function(req, res) {
|
app.get('/log', function(req, res) {
|
||||||
res.redirect('/log/identicurse');
|
res.render('log', { 'name': dbot.name, 'log': (dbot.log || []) });
|
||||||
});
|
|
||||||
|
|
||||||
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
|
// Lists the quote categories
|
||||||
|
Loading…
Reference in New Issue
Block a user