var _ = require('underscore')._; var commands = function(dbot) { var polls = dbot.db.polls; var commands = { '~newpoll': function(event) { var name = event.input[1].toLowerCase(), options = event.input[2].toLowerCase().split(','), description = event.input[3]; if(_.has(polls, name)) { event.reply(dbot.t('poll_exists', { 'name': name })); } else { polls[name] = { 'name': name, 'description': description, 'owner': dbot.api.users.resolveUser(event.server, event.user), 'votes': {}, 'votees': {} }; for(var i=0;i