diff options
author | 2021-05-09 20:45:13 -0300 | |
---|---|---|
committer | 2021-05-09 20:45:13 -0300 | |
commit | 5320a38afe1810ccb445f61e74a7facf5b0e9e5a (patch) | |
tree | 6eb789845e6ba523b0bd886d990ded4bbb11f68c | |
parent | use gold colour from constants.py for consistency (diff) |
minor tweaks as suggested by vcokltfre
see their five change requests for details
-rw-r--r-- | bot/exts/evergreen/trivia_quiz.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/bot/exts/evergreen/trivia_quiz.py b/bot/exts/evergreen/trivia_quiz.py index 31d9dbce..51e24226 100644 --- a/bot/exts/evergreen/trivia_quiz.py +++ b/bot/exts/evergreen/trivia_quiz.py @@ -88,7 +88,7 @@ def linear_system(q_format: str, a_format: str) -> QAndA: def mod_arith(q_format: str, a_format: str) -> QAndA: """Generate a basic modular arithmetic question.""" quotient, m, b = random.randint(30, 40), random.randint(10, 20), random.randint(200, 350) - ans = random.randint(0, 9) # max 9 because min mod 10 + ans = random.randint(0, 9) # max remainder is 9, since the minimum modulus is 10 a = quotient * m + ans - b question = q_format.format(a, b, m) @@ -133,11 +133,7 @@ def binary_calc(q_format: str, a_format: str) -> QAndA: a -= 5 b -= 5 - question = q_format.format( - a, - oper[0], - b, - ) + question = q_format.format(a, oper[0], b) answer = a_format.format(oper[1](a, b)) return question, answer @@ -165,7 +161,7 @@ def taxonomic_rank(q_format: str, a_format: str) -> QAndA: def base_units_convert(q_format: str, a_format: str) -> QAndA: """Generate a SI base units conversion question.""" - unit = random.choice(list(UNITS_TO_BASE_UNITS.keys())) + unit = random.choice(list(UNITS_TO_BASE_UNITS)) question = q_format.format( unit + " " + UNITS_TO_BASE_UNITS[unit][0] @@ -405,7 +401,7 @@ class TriviaQuiz(commands.Cog): def make_start_embed(self, category: str) -> discord.Embed: """Generate a starting/introduction embed for the quiz.""" start_embed = discord.Embed( - colour=discord.Colour.red(), + colour=Colours.blue, title="Quiz game starting!", description=( f"Each game consists of {self.question_limit + 1} questions.\n" @@ -538,9 +534,11 @@ class TriviaQuiz(commands.Cog): """Send the correct answer of a question to the game channel.""" info = question_dict.get("info", "") + word = "is" if len(answers) == 1 else "are" + embed = discord.Embed( color=Colours.bright_green, - title=f"The correct answer is/are **`{', '.join(answers)}`**\n", + title=f"The correct answer {word} **`{', '.join(answers)}`**\n", ) if info != "": |