wrote some of viewpoll. Hello dan.

This commit is contained in:
Luke Slater 2012-06-14 23:57:07 +01:00
parent ffd383365e
commit d012ff4394

View File

@ -34,7 +34,7 @@ var poll = function(dbot) {
var vote = event.input[2]; var vote = event.input[2];
if(polls.hasOwnProperty(name)) { if(polls.hasOwnProperty(name)) {
if(event.user in polls[name].votees) { if(polls[name].votees.include(event.user)) {
event.reply(dbot.t('alread_voted')); event.reply(dbot.t('alread_voted'));
} else { } else {
if(polls[name].votes.hasOwnProperty(vote)) { if(polls[name].votes.hasOwnProperty(vote)) {
@ -50,16 +50,18 @@ var poll = function(dbot) {
} }
}, },
'~rmpoll': function(event) { '~viewpoll': function(event) {
var name = event.input[1];
}, if(polls.hasOwnProperty(name)) {
'~results': function(event) {
} else {
event.reply(dbot.t('poll_unexistent'));
}
} }
}; };
commands['~newpoll'].regex = [/~newpoll ([^ ]+) \[options=([^ ]+)\] (.+)/, 4]; commands['~newpoll'].regex = [/~newpoll ([^ ]+) \[options=([^ ]+)\] (.+)/, 4];
commands['~vote'].regex = [/~vote ([^ ]+) ([^ ]+)/, 3]; commands['~vote'].regex = [/~vote ([^ ]+) ([^ ]+)/, 3];
commands['~viewpoll'].regex = [/~viewpoll ([^ ]+)/, 2];
return { return {
'name': 'poll', 'name': 'poll',