var poll = function(dbot) { var polls = dbot.db.polls; var commands = { '~newpoll': function(event) { 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')); } else { if(polls.hasOwnProperty(name)) { event.reply(dbot.t('poll_exists', {'name': name})); } else { if(av) { polls[name] = { 'av': av, 'name': name, 'description': description, 'owner': event.user, 'votes': {}, 'options': [] }; for(var i=0;i