2013-08-18 22:23:13 +02:00
|
|
|
var _ = require('underscore')._;
|
|
|
|
|
|
|
|
var pages = function(dbot) {
|
|
|
|
return {
|
2013-08-24 15:56:45 +02:00
|
|
|
'/bans': function(req, res) {
|
2013-08-18 22:23:13 +02:00
|
|
|
res.render('servers', {
|
|
|
|
'servers': _.keys(dbot.config.servers)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-04-12 00:01:59 +02:00
|
|
|
'/underbans': function(req, res) {
|
|
|
|
this.db.search('nbans', { 'server': server }, function(ban) {
|
|
|
|
if(ban.reason.match('#underban')) {
|
|
|
|
bans.push(ban);
|
|
|
|
}
|
|
|
|
}, function() {
|
|
|
|
res.render('bans', {
|
|
|
|
'server': server,
|
|
|
|
'bans': bans
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2013-08-24 15:56:45 +02:00
|
|
|
'/bans/:server': function(req, res) {
|
2013-08-18 22:23:13 +02:00
|
|
|
var server = req.params.server,
|
|
|
|
bans = [];
|
|
|
|
|
|
|
|
this.db.search('nbans', { 'server': server }, function(ban) {
|
|
|
|
bans.push(ban);
|
|
|
|
}, function() {
|
|
|
|
res.render('bans', {
|
|
|
|
'server': server,
|
|
|
|
'bans': bans
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.fetch = function(dbot) {
|
|
|
|
return pages(dbot);
|
|
|
|
};
|