3
0
mirror of https://github.com/reality/dbot.git synced 2025-01-11 12:32:36 +01:00

polls case insensitive [#155]

This commit is contained in:
reality 2013-01-19 13:34:42 +00:00
parent fad3eda601
commit 94363a6d8f

View File

@ -4,8 +4,8 @@ var commands = function(dbot) {
var polls = dbot.db.polls;
var commands = {
'~newpoll': function(event) {
var name = event.input[1],
options = event.input[2].split(','),
var name = event.input[1].toLowerCase(),
options = event.input[2].toLowerCase().split(','),
description = event.input[3];
if(_.has(polls, name)) {
@ -34,8 +34,8 @@ var commands = function(dbot) {
},
'~addoption': function(event) {
var name = event.input[1],
option = event.input[2];
var name = event.input[1].toLowerCase(),
option = event.input[2].toLowerCase();
if(_.has(polls, name)) {
if(polls[name].owner === event.user) {
@ -65,8 +65,8 @@ var commands = function(dbot) {
},
'~rmoption': function(event) {
var name = event.input[1],
option = event.input[2];
var name = event.input[1].toLowerCase(),
option = event.input[2].toLowerCase();
if(_.has(polls, name)) {
if(polls[name].owner === event.user) {
@ -89,8 +89,8 @@ var commands = function(dbot) {
},
'~vote': function(event) {
var name = event.input[1],
vote = event.input[2];
var name = event.input[1].toLowerCase(),
vote = event.input[2].toLowerCase();
if(_.has(polls, name)) {
if(_.has(polls[name].votes, vote)) {
@ -125,7 +125,7 @@ var commands = function(dbot) {
},
'~pdesc': function(event) {
var name = event.input[1];
var name = event.input[1].toLowerCase();
if(_.has(polls, name)) {
event.reply(dbot.t('poll_describe', {
@ -143,7 +143,7 @@ var commands = function(dbot) {
},
'~count': function(event) {
var name = event.input[1];
var name = event.input[1].toLowerCase();
if(_.has(polls, name)) {
var order;