var poll = function(dbot) { if(!dbot.db.hasOwnProperty('polls')) { dbot.db.polls = {}; } 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]; 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 { polls[name] = { 'name': name, 'description': description, 'owner': event.user, 'votes': {}, 'votees': {} }; for(var i=0;i