From 8fe032579d25ef4ead513c9f6f04191c433d1d93 Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 22 Feb 2018 18:28:10 +0000 Subject: [PATCH] prevent multiple yes votes by using votequiet fallback (lol) --- modules/kick/commands.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index bf2baea..aeb23c6 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -344,16 +344,20 @@ var commands = function(dbot) { event.reply('A votequiet attempt has already been made on this user in the last 10 minutes.'); } else { var vq = this.voteQuiets[user.id] - vq.yes.push(event.rUser.primaryNick); + if(!_.include(vq.yes, event.rUser.primaryNick)) { + vq.yes.push(event.rUser.primaryNick); - event.reply('There is already a votequiet attempt active for this user, adding yes vote to existing poll.'); - event.reply('Voted yes on votequiet for ' + target + '. New count: Yes (' + vq.yes.length + '). No (' + vq.no.length + ').'); + event.reply('There is already a votequiet attempt active for this user, adding yes vote to existing poll.'); + event.reply('Voted yes on votequiet for ' + target + '. New count: Yes (' + vq.yes.length + '). No (' + vq.no.length + ').'); - if(vq.yes.length == 4) { - event.reply('Attempt to quiet ' + target + ' succeeded. Count: Yes (' + vq.yes.length + '). No (' + vq.no.length + ').'); - this.api.quietUser(event.server, event.rUser, '10m', event.channel, target, reason + '[votequiet]', function(response) { - event.reply(response); - }); + if(vq.yes.length == 4) { + event.reply('Attempt to quiet ' + target + ' succeeded. Count: Yes (' + vq.yes.length + '). No (' + vq.no.length + ').'); + this.api.quietUser(event.server, event.rUser, '10m', event.channel, target, reason + '[votequiet]', function(response) { + event.reply(response); + }); + } + } else { + event.reply('There is already a votequiet attempt active for this user, and you already voted yes!'); } } }