From 8c97d64534f048de121bf28288be019cd3b41c7d Mon Sep 17 00:00:00 2001 From: rootcoma Date: Wed, 6 Nov 2013 09:32:34 -0800 Subject: [PATCH] Added check to .report, can't report question being asked --- plugin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugin.py b/plugin.py index 371a904..029dd2e 100644 --- a/plugin.py +++ b/plugin.py @@ -239,7 +239,7 @@ class TriviaTime(callbacks.Plugin): irc.noReply() alltime = wrap(alltime) """ - + def edit(self, irc, msg, arg, num, question): """ Correct a question by providing the question number and the corrected text. @@ -349,7 +349,11 @@ class TriviaTime(callbacks.Plugin): """ channel = str.lower(msg.args[0]) username = str.lower(msg.nick) - question = self.storage.getQuestionByRound(roundNum, msg.args[0]) + if channel in self.games: + if self.games[channel].numAsked == roundNum: + irc.reply("Sorry you must wait until the current question is over to report it.") + return + question = self.storage.getQuestionByRound(roundNum, channel) if len(question) > 0: question = question[0] inp = text.strip() @@ -359,7 +363,6 @@ class TriviaTime(callbacks.Plugin): newOne = regex[1] oldOne = regex[0] newQuestionText = question[2].replace(oldOne, newOne) - #log.info(newQuestionText) self.storage.insertEdit(question[0], newQuestionText, username, channel) irc.reply('** Regex detected ** Your report has been submitted!') irc.reply('NEW:%s' % (newQuestionText))