From a08e127f1535f63a24e785bfb1c16c445491303d Mon Sep 17 00:00:00 2001 From: Shom770 <82843611+Shom770@users.noreply.github.com> Date: Thu, 4 Nov 2021 16:02:37 -0400 Subject: bug fixes --- bot/exts/events/trivianight/_questions.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'bot/exts/events/trivianight/_questions.py') diff --git a/bot/exts/events/trivianight/_questions.py b/bot/exts/events/trivianight/_questions.py index aaedf068..8f2f5571 100644 --- a/bot/exts/events/trivianight/_questions.py +++ b/bot/exts/events/trivianight/_questions.py @@ -1,3 +1,4 @@ +import logging from random import choice, randrange from time import perf_counter from typing import Optional, TypedDict, Union @@ -10,6 +11,8 @@ from bot.constants import Colours, NEGATIVE_REPLIES from ._scoreboard import Scoreboard +logger = logging.getLogger(__name__) + class UserScore: """Marker class for passing into the scoreboard to add points/record speed.""" @@ -93,7 +96,9 @@ class QuestionView(View): for button in self.buttons: self.add_item(button) - def create_current_question(self) -> Embed: + self.active_question = False + + def create_current_question(self) -> Union[Embed, None]: """Helper function to create the embed for the current question.""" question_embed = Embed( title=f"Question {self.current_question['number']}", @@ -110,6 +115,8 @@ class QuestionView(View): time_limit = self.current_question.get("time", 10) + self.active_question = True + return question_embed, time_limit def end_question(self) -> tuple[dict, Embed]: @@ -151,6 +158,8 @@ class QuestionView(View): time_limit = self.current_question.get("time", 10) question_points = self.current_question.get("points", 10) + self.active_question = False + return return_dict, answer_embed, time_limit, question_points @@ -183,7 +192,7 @@ class Questions: while "visited" in self.questions[question_number].keys(): question_number = randrange(0, len(self.questions)) else: - question_number = number + question_number = number - 1 self.questions[question_number]["visited"] = True self.view.current_question = self.questions[question_number] -- cgit v1.2.3