dbot/modules/kick/pages.js

30 lines
709 B
JavaScript
Raw Normal View History

2013-08-18 22:23:13 +02:00
var _ = require('underscore')._;
var pages = function(dbot) {
return {
'/bans': function(req, res) {
2013-08-18 22:23:13 +02:00
res.render('servers', {
'servers': _.keys(dbot.config.servers)
});
},
'/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);
};