Permalink
Browse files

[fix] Fixed regex in beer listener.

  • Loading branch information...
1 parent 6221134 commit f047b21a5b614f52c18333f369b4793d554fde46 @AvianFlu AvianFlu committed Oct 21, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/listeners/beer.js
View
@@ -14,7 +14,7 @@ var beer = module.exports = function () {
self.preferences = self.config.get('karma:preferences') || {};
self.on('*::gotMessage', function (data) {
- var re = /^(\w+)((:|,) )?(\+\+|--)/,
+ var re = /^[\+-]?(\w+)([:, ]){0,3}(\+\+|--)/,
res;
if (res = re.exec(data.text)) {
@@ -25,10 +25,10 @@ var beer = module.exports = function () {
});
}
self.karma[res[1]] || (self.karma[res[1]] = 0);
- if (res[4] == '++') {
+ if (res[3] == '++') {
++self.karma[res[1]];
}
- else if (res[4] == '--') {
+ else if (res[3] == '--') {
--self.karma[res[1]];
}

0 comments on commit f047b21

Please sign in to comment.