3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00
dbot/modules/flashy/flashy.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

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