3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-27 05:02:36 +01:00
dbot/modules/kick/pages.js

47 lines
946 B
JavaScript
Raw Normal View History

2013-08-18 22:23:13 +02:00
var _ = require('underscore')._;
2018-05-05 19:35:49 +02:00
var pages = function (dbot) {
return {
'/bans': function (req, res) {
res.render('servers', {
'servers': _.keys(dbot.config.servers)
});
},
2013-08-18 22:23:13 +02:00
2018-05-05 19:35:49 +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
});
});
},
2016-04-12 00:01:59 +02:00
2018-05-05 19:35:49 +02:00
'/bans/:server': function (req, res) {
var server = req.params.server,
bans = [];
2013-08-18 22:23:13 +02:00
2018-05-05 19:35:49 +02:00
this.db.search('nbans', {
'server': server
}, function (ban) {
bans.push(ban);
}, function () {
res.render('bans', {
'server': server,
'bans': bans
});
});
2013-08-18 22:23:13 +02:00
}
2018-05-05 19:35:49 +02:00
}
2013-08-18 22:23:13 +02:00
};
2018-05-05 19:35:49 +02:00
exports.fetch = function (dbot) {
return pages(dbot);
2013-08-18 22:23:13 +02:00
};