diff options
Diffstat (limited to 'bot/exts/events/trivianight/_questions.py')
| -rw-r--r-- | bot/exts/events/trivianight/_questions.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bot/exts/events/trivianight/_questions.py b/bot/exts/events/trivianight/_questions.py index 6937d8ec..8b4df74d 100644 --- a/bot/exts/events/trivianight/_questions.py +++ b/bot/exts/events/trivianight/_questions.py @@ -162,7 +162,7 @@ class Questions: If the number parameter is specified, it'll head to that specific question. """ - if all("visited" in question.keys() for question in self.questions): + if all("visited" in question.keys() for question in self.questions) and number is None: return Embed( title=choice(NEGATIVE_REPLIES), description="All of the questions in the question bank have been used.", @@ -179,7 +179,7 @@ class Questions: self.questions[question_number]["visited"] = True self.view.current_question = self.questions[question_number] - def list_questions(self) -> str: + def list_questions(self) -> Union[Embed, str]: """ Lists all questions from the question bank. @@ -188,11 +188,16 @@ class Questions: - Question description - If the question was already 'visited' (displayed) """ + if not self.questions: + return Embed( + title=choice(NEGATIVE_REPLIES), + description="No questions are currently loaded in!", + color=Colours.soft_red + ) spaces = len(sorted(self.questions, key=lambda question: len(question['description']))[-1]["description"]) + 3 formatted_string = "" for question in self.questions: - question_description = question['description'].replace("\u200b", "") - formatted_string += f"`Q{question['number']}: {question_description!r}" \ + formatted_string += f"`Q{question['number']}: {question['description']}" \ f"{' ' * (spaces - len(question['description']) + 2)}" \ f"|` {':x:' if not question.get('visited') else ':checkmark:'}\n" |