diff options
Diffstat (limited to 'bot/exts/events/trivianight/_game.py')
| -rw-r--r-- | bot/exts/events/trivianight/_game.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bot/exts/events/trivianight/_game.py b/bot/exts/events/trivianight/_game.py index 9d8b98c1..7f667dcf 100644 --- a/bot/exts/events/trivianight/_game.py +++ b/bot/exts/events/trivianight/_game.py @@ -33,6 +33,10 @@ class AlreadyUpdated(RuntimeError): """Exception raised when the user has already updated their guess once.""" +class AllQuestionsVisited(RuntimeError): + """Exception raised when all of the questions have been visited.""" + + class Question: """Interface for one question in a trivia night game.""" @@ -142,6 +146,8 @@ class TriviaNightGame: question = [q for q in self._all_questions if q.number == number][0] except IndexError: raise ValueError(f"Question number {number} does not exist.") + elif len(self._questions) == 0: + raise AllQuestionsVisited("All of the questions have been visited.") else: question = self._questions.pop(randrange(len(self._questions))) @@ -161,7 +167,7 @@ class TriviaNightGame: self.current_question.stop() self.current_question = None - def list_questions(self) -> None: + def list_questions(self) -> str: """ List all the questions. |