add more colours, automatic upper case and help output

This commit is contained in:
reality 2013-04-09 22:14:15 +00:00
parent 381a78e311
commit 52d232a2e6

View File

@ -7,15 +7,19 @@ var _ = require('underscore')._;
var flashy = function(dbot) { var flashy = function(dbot) {
this.colourMap = { this.colourMap = {
'white': 'FFFFFF',
'red': 'FF0000', 'red': 'FF0000',
'green': '00FF00', 'green': '00FF00',
'blue': '0000FF' 'blue': '0000FF',
'yellow': 'FFFF00',
'magenta': 'FF00FF',
'cyan': '00FFFF'
}; };
this.commands = { this.commands = {
'~flashy': function(event) { '~flashy': function(event) {
var colour = event.input[1]; var colour = event.input[1].trim();
var text = event.input[2]; var text = event.input[2].trim().toUpperCase();
if(_.has(this.colourMap, colour)) { if(_.has(this.colourMap, colour)) {
event.reply(dbot.t('url', { event.reply(dbot.t('url', {
@ -24,7 +28,8 @@ var flashy = function(dbot) {
'path': 'flashy/' + colour + '/' + encodeURIComponent(text) 'path': 'flashy/' + colour + '/' + encodeURIComponent(text)
})); }));
} else { } else {
event.reply('no such colour brah'); var possibleColours = _.keys(this.colourMap).join(', ').slice(0, -2) + '.';
event.reply('No such colour, brah. Available colours are: ' + possibleColours);
} }
} }
}; };