nodejitsu / kohai

I am kohai. I am a pluggable irc bot for managing real-time data events.
91 stars 17 forks source link

Refactor !insult switch / case #51

Closed Marak closed 13 years ago

Marak commented 13 years ago

https://github.com/nodejitsu/kohai/blob/master/lib/plugins/alias.js#L30

This method needs to be refactored.

Insults should be stored as an array of strings in the config.json file. The code for sending insults should only be a few lines long.

The switch / case in this block of code has introduced an anti-pattern. You need to uncouple the data ( insults ) from the logic ( sending insults ).