dbot/modules-stock/flashy/pages.js
Georg 70a21d2b18
Signed-off-by: Georg <georg@lysergic.dev>
Init

- Initial fixes in modules
- Bundled adapted jsbot
- Elaborative README.md
2021-08-24 21:16:26 +02:00

22 lines
576 B
JavaScript

var _ = require('underscore')._;
var pages = function(dbot) {
return {
'/flashy/:colour/:text': function(req, res) {
if(!_.has(this.colourMap, req.params.colour)) {
req.params.colour = 'red';
}
var colour = this.colourMap[req.params.colour];
res.render('flashy', {
'name': dbot.config.name,
'colour': colour,
'text': decodeURIComponent(req.params.text)
});
}
};
};
exports.fetch = function(dbot) {
return pages(dbot);
};