anjanms / DubAPI

A Node.js API for creating queup.net bots.
MIT License
20 stars 10 forks source link

Add getDubs function #13

Closed coryshaw1 closed 8 years ago

anjanms commented 8 years ago

Hey, thanks for taking the time to submit a PR.

Though, I'm a bit puzzled. What use case does this cover that existing functions don't? getScore and getUsers cover everything I can think of as far as dubs.

coryshaw1 commented 8 years ago

Ah, I honestly didn't test out the getScore function to see what it did. That does give the total number of updubs and downdubs, but returning this._.room.play.dubs will also give the userids of the votes casted. This allows for you to see who has voted what.

anjanms commented 8 years ago

Every user has a dub property which can be 'updub', 'downdub' or undefined. You can do bot.getUsers().filter(function(usr) {return usr.dub === 'updub';}) and get their IDs as well as everything else about the users.

I know this isn't documented too well. I haven't quite got the hang of writing useful docs yet.

coryshaw1 commented 8 years ago

Ah didn't notice that property on the user object. getDubs definitely isn't needed. Closing now.