2013-04-09 17:20:07 +02:00
|
|
|
/**
|
|
|
|
* Module Name: Flashy
|
|
|
|
* Description: Makes pages with flashing text and that innit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var _ = require('underscore')._;
|
|
|
|
|
|
|
|
var flashy = function(dbot) {
|
|
|
|
this.colourMap = {
|
2013-04-10 00:14:15 +02:00
|
|
|
'white': 'FFFFFF',
|
2013-04-09 17:28:56 +02:00
|
|
|
'red': 'FF0000',
|
|
|
|
'green': '00FF00',
|
2013-04-10 00:14:15 +02:00
|
|
|
'blue': '0000FF',
|
|
|
|
'yellow': 'FFFF00',
|
2013-04-11 23:57:42 +02:00
|
|
|
'pink': 'FFC0CB',
|
2013-04-10 00:14:15 +02:00
|
|
|
'magenta': 'FF00FF',
|
2013-04-11 23:57:42 +02:00
|
|
|
'purple': 'AA00FF',
|
|
|
|
'cyan': '00FFFF',
|
|
|
|
'orange': 'FFAA00',
|
|
|
|
'lime': 'AAFF00',
|
|
|
|
'grey': 'AAAAAA',
|
|
|
|
'infrared': '000000'
|
2013-04-09 17:20:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
this.commands = {
|
|
|
|
'~flashy': function(event) {
|
2013-04-10 00:33:07 +02:00
|
|
|
var colour = event.input[1];
|
2013-04-10 00:14:15 +02:00
|
|
|
var text = event.input[2].trim().toUpperCase();
|
2013-04-09 17:20:07 +02:00
|
|
|
|
|
|
|
if(_.has(this.colourMap, colour)) {
|
2013-04-10 00:07:11 +02:00
|
|
|
event.reply(dbot.t('url', {
|
2013-04-09 17:20:07 +02:00
|
|
|
'host': dbot.config.web.webHost,
|
|
|
|
'port': dbot.config.web.webPort,
|
|
|
|
'path': 'flashy/' + colour + '/' + encodeURIComponent(text)
|
2013-04-10 00:07:11 +02:00
|
|
|
}));
|
2013-04-09 17:20:07 +02:00
|
|
|
} else {
|
2013-04-10 00:15:17 +02:00
|
|
|
var possibleColours = _.keys(this.colourMap).join(', ') + '.';
|
2013-04-10 00:14:15 +02:00
|
|
|
event.reply('No such colour, brah. Available colours are: ' + possibleColours);
|
2013-04-09 17:20:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-04-10 00:33:07 +02:00
|
|
|
this.commands['~flashy'].regex = [/^~flashy ([^ ]+) (.+)$/, 3];
|
2013-04-09 17:20:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.fetch = function(dbot) {
|
|
|
|
return new flashy(dbot);
|
|
|
|
};
|