From b5455d1bf5cfe72d006ec4a82377090a640ca4e5 Mon Sep 17 00:00:00 2001 From: Morfent Date: Mon, 30 Mar 2015 04:43:01 -0300 Subject: [PATCH] Trivia plugin: fix crash in /trivia kick --- chat-plugins/trivia.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/chat-plugins/trivia.js b/chat-plugins/trivia.js index 5be7fa503e..154c4f9864 100644 --- a/chat-plugins/trivia.js +++ b/chat-plugins/trivia.js @@ -108,15 +108,12 @@ var Trivia = (function () { Trivia.prototype.kickParticipant = function (output, target) { if (this.participants.size < 3) return output.sendReply('The trivia game requires at least three participants in order to run.'); - target = output.splitTarget(target); - var targetUser = output.targetUser; - var name = output.targetUsername; - var userid = toId(name); - if (!userid || !targetUser) return output.sendReply('User "' + name + '" does not exist.'); - if (!this.participants.has(userid)) return output.sendReply('User "' + name + '" is not a participant in this trivia game.'); + var userid = toId(target); + if (!userid) return output.sendReply('User "' + target + '" does not exist.'); + if (!this.participants.has(userid)) return output.sendReply('User "' + target + '" is not a participant in this trivia game.'); this.participants.delete(userid); - output.sendReply('User "' + name + '" has been disqualified from the trivia game.'); + output.sendReply('User "' + target + '" has been disqualified from the trivia game.'); }; Trivia.prototype.startGame = function (output) {