diff --git a/modules/poll.js b/modules/poll.js index cebb735..e8deed1 100644 --- a/modules/poll.js +++ b/modules/poll.js @@ -6,9 +6,10 @@ var poll = function(dbot) { var polls = dbot.db.polls; var commands = { '~newpoll': function(event) { - var name = event.input[1]; - var options = event.input[2].split(','); - var description = event.input[3]; + var av = event.input[1] != undefined; + var name = event.input[2]; + var options = event.input[3].split(','); + var description = event.input[4]; if(name === undefined || name === 'help') { event.reply(dbot.t('newpoll_usage')); @@ -16,16 +17,30 @@ var poll = function(dbot) { if(polls.hasOwnProperty(name)) { event.reply(dbot.t('poll_exists', {'name': name})); } else { - polls[name] = { - 'name': name, - 'description': description, - 'owner': event.user, - 'votes': {}, - 'votees': {} - }; - - for(var i=0;i