finish off poll using new users api [#434]

This commit is contained in:
reality 2013-05-06 20:00:31 +00:00
parent 75a909df64
commit 5b0f4d3ae8

View File

@ -70,17 +70,17 @@ var commands = function(dbot) {
} }
} }
}.bind(this)); }.bind(this));
}); }.bind(this));
}, },
'~rmoption': function(event) { '~rmoption': function(event) {
var name = event.input[1].toLowerCase(), var name = event.input[1].toLowerCase(),
option = event.input[2].toLowerCase(), option = event.input[2].toLowerCase();
user = dbot.api.users.resolveUser(event.server, event.user);
dbot.api.users.resolveUser(event.server, event.user, function(user) {
this.db.read('poll', name, function(err, poll) { this.db.read('poll', name, function(err, poll) {
if(!err) { if(!err) {
if(poll.owner === user) { if(poll.owner === user.id) {
if(_.has(poll.votes, option)) { if(_.has(poll.votes, option)) {
delete poll.votes[option]; delete poll.votes[option];
@ -103,6 +103,7 @@ var commands = function(dbot) {
} }
} }
}.bind(this)); }.bind(this));
}.bind(this));
}, },
'~vote': function(event) { '~vote': function(event) {