mirror of
https://github.com/reality/dbot.git
synced 2024-11-30 16:09:27 +01:00
finish off poll using new users api [#434]
This commit is contained in:
parent
75a909df64
commit
5b0f4d3ae8
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user