forked from GitHub/dbot
polls case insensitive [#155]
This commit is contained in:
parent
fad3eda601
commit
94363a6d8f
@ -4,8 +4,8 @@ var commands = function(dbot) {
|
|||||||
var polls = dbot.db.polls;
|
var polls = dbot.db.polls;
|
||||||
var commands = {
|
var commands = {
|
||||||
'~newpoll': function(event) {
|
'~newpoll': function(event) {
|
||||||
var name = event.input[1],
|
var name = event.input[1].toLowerCase(),
|
||||||
options = event.input[2].split(','),
|
options = event.input[2].toLowerCase().split(','),
|
||||||
description = event.input[3];
|
description = event.input[3];
|
||||||
|
|
||||||
if(_.has(polls, name)) {
|
if(_.has(polls, name)) {
|
||||||
@ -34,8 +34,8 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'~addoption': function(event) {
|
'~addoption': function(event) {
|
||||||
var name = event.input[1],
|
var name = event.input[1].toLowerCase(),
|
||||||
option = event.input[2];
|
option = event.input[2].toLowerCase();
|
||||||
|
|
||||||
if(_.has(polls, name)) {
|
if(_.has(polls, name)) {
|
||||||
if(polls[name].owner === event.user) {
|
if(polls[name].owner === event.user) {
|
||||||
@ -65,8 +65,8 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'~rmoption': function(event) {
|
'~rmoption': function(event) {
|
||||||
var name = event.input[1],
|
var name = event.input[1].toLowerCase(),
|
||||||
option = event.input[2];
|
option = event.input[2].toLowerCase();
|
||||||
|
|
||||||
if(_.has(polls, name)) {
|
if(_.has(polls, name)) {
|
||||||
if(polls[name].owner === event.user) {
|
if(polls[name].owner === event.user) {
|
||||||
@ -89,8 +89,8 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'~vote': function(event) {
|
'~vote': function(event) {
|
||||||
var name = event.input[1],
|
var name = event.input[1].toLowerCase(),
|
||||||
vote = event.input[2];
|
vote = event.input[2].toLowerCase();
|
||||||
|
|
||||||
if(_.has(polls, name)) {
|
if(_.has(polls, name)) {
|
||||||
if(_.has(polls[name].votes, vote)) {
|
if(_.has(polls[name].votes, vote)) {
|
||||||
@ -125,7 +125,7 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'~pdesc': function(event) {
|
'~pdesc': function(event) {
|
||||||
var name = event.input[1];
|
var name = event.input[1].toLowerCase();
|
||||||
|
|
||||||
if(_.has(polls, name)) {
|
if(_.has(polls, name)) {
|
||||||
event.reply(dbot.t('poll_describe', {
|
event.reply(dbot.t('poll_describe', {
|
||||||
@ -143,7 +143,7 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'~count': function(event) {
|
'~count': function(event) {
|
||||||
var name = event.input[1];
|
var name = event.input[1].toLowerCase();
|
||||||
|
|
||||||
if(_.has(polls, name)) {
|
if(_.has(polls, name)) {
|
||||||
var order;
|
var order;
|
||||||
|
Loading…
Reference in New Issue
Block a user