diff options
| author | 2023-08-10 06:04:31 +0000 | |
|---|---|---|
| committer | 2023-08-10 06:04:31 +0000 | |
| commit | f897f6c576d7dca764c9c0515b2c576e7fb0daea (patch) | |
| tree | 4609c804db7ad9e0c4f415fc0e8a8353f2dfc6e1 /bot/exts/events/trivianight/_game.py | |
| parent | Bump rapidfuzz from 3.1.2 to 3.2.0 (#1341) (diff) | |
Bump ruff from 0.0.272 to 0.0.280 (#1333)
Co-authored-by: wookie184 <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Lovering <[email protected]>
Co-authored-by: ChrisJL <[email protected]>
Diffstat (limited to 'bot/exts/events/trivianight/_game.py')
| -rw-r--r-- | bot/exts/events/trivianight/_game.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/exts/events/trivianight/_game.py b/bot/exts/events/trivianight/_game.py index 15126f60..0568ce81 100644 --- a/bot/exts/events/trivianight/_game.py +++ b/bot/exts/events/trivianight/_game.py @@ -134,7 +134,7 @@ class TriviaNightGame: def __iter__(self) -> Iterable[Question]: return iter(self._questions) - def next_question(self, number: str = None) -> Question: + def next_question(self, number: str | None = None) -> Question: """ Consume one random question from the trivia night game. @@ -145,7 +145,7 @@ class TriviaNightGame: if number is not None: try: - question = [q for q in self._all_questions if q.number == int(number)][0] + question = next(q for q in self._all_questions if q.number == int(number)) except IndexError: raise ValueError(f"Question number {number} does not exist.") elif len(self._questions) == 0: |