Permalink
Browse files

[beer] Handle strings like 'kohai: ++' (issue #64)

  • Loading branch information...
mmalecki committed Oct 15, 2011
1 parent 7bfe7fc commit c63d0bb9ed8056331b0dc1bf6718da99774b0be3
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.on('*::gotMessage', function (data) {
- var re = /(\w+)(\+\+|--)/,
+ var re = /(\w+)((:|,) )?(\+\+|--)/,
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[2] == '++') {
+ if (res[4] == '++') {
++self.karma[res[1]];
}
- else if (res[2] == '--') {
+ else if (res[4] == '--') {
--self.karma[res[1]];
}
return self.emit('sendMsg', {

0 comments on commit c63d0bb

Please sign in to comment.