From 0a2b94fa654969e7d55d9cc3f46864f78ad41d5e Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Wed, 13 Jun 2012 21:11:00 +0100 Subject: [PATCH] newpoll test --- modules/poll.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 modules/poll.js diff --git a/modules/poll.js b/modules/poll.js new file mode 100644 index 0000000..ff2e3ba --- /dev/null +++ b/modules/poll.js @@ -0,0 +1,48 @@ +var poll = function(dbot) { + var polls = dbot.db.polls; + var commands = { + '~newpoll': function(event) { + var name = event.input[1]; + if(name === undefined || name === 'help') { + event.reply(dbot.t('newpoll_usage')); + } else { + if(polls.hasOwnProperty(name)) { + event.reply(dbot.t('poll_exists')); + } else { + polls[name] = { + 'name': name, + 'owner': event.user + }; + + var options = event.input[2].split(','); + for(var i=0;i