Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[beer] Use preferences data (issue #64)

  • Loading branch information...
commit 58dcc7741f12dd692e9fea0963fa8528f772e7f5 1 parent f7f7ac1
@mmalecki mmalecki authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/listeners/beer.js
View
8 lib/listeners/beer.js
@@ -11,6 +11,7 @@ var beer = module.exports = function () {
var self = this;
self.karma = {};
+ self.preferences = {};
self.on('*::gotMessage', function (data) {
var re = /(\w+)(\+\+|--)/,
@@ -26,10 +27,15 @@ var beer = module.exports = function () {
}
return self.emit('sendMsg', {
dest: data.to,
- msg: res[1] + ' has ' + self.karma[res[1]] + ' beer' +
+ msg: res[1] + ' has ' + self.karma[res[1]] + ' ' +
+ (self.preferences[res[1]] || 'beer') +
((Math.abs(self.karma[res[1]]) > 1) ? 's' : '')
});
}
});
+
+ self.on('karmaPreferenceSet', function (data) {
+ self.preferences[data.nick] = data.preference;
+ });
};
Please sign in to comment.
Something went wrong with that request. Please try again.