diff options
author | 2021-11-16 18:39:14 -0500 | |
---|---|---|
committer | 2022-02-09 18:13:37 -0500 | |
commit | c0917e9de25321f1d533568a0abe2bef8ee8c91b (patch) | |
tree | 220f411b90af9df19317d2ce6ebfb655efce9eea | |
parent | map percentage of people who got it correct to color (diff) |
fixing rivianight reset bugs
buttons would be repeated due to a faulty reset
-rw-r--r-- | bot/exts/events/trivianight/_scoreboard.py | 4 | ||||
-rw-r--r-- | bot/exts/events/trivianight/trivianight.py | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/bot/exts/events/trivianight/_scoreboard.py b/bot/exts/events/trivianight/_scoreboard.py index e9678bb8..08025214 100644 --- a/bot/exts/events/trivianight/_scoreboard.py +++ b/bot/exts/events/trivianight/_scoreboard.py @@ -113,12 +113,12 @@ class Scoreboard: def __setitem__(self, key: str, value: int): if value.get("points") and key.user_id not in self.view.points.keys(): self.view.points[key.user_id] = value["points"] - else: + elif value.get("points"): self.view.points[key.user_id] += self.view.points[key.user_id] if value.get("speed") and key.user_id not in self.view.speed.keys(): self.view.speed[key.user_id] = [1, value["speed"]] - else: + elif value.get("speed"): self.view.speed[key.user_id] = [ self.view.speed[key.user_id][0] + 1, self.view.speed[key.user_id][1] + value["speed"] ] diff --git a/bot/exts/events/trivianight/trivianight.py b/bot/exts/events/trivianight/trivianight.py index 75d2c671..224b0620 100644 --- a/bot/exts/events/trivianight/trivianight.py +++ b/bot/exts/events/trivianight/trivianight.py @@ -94,13 +94,18 @@ class TriviaNight(commands.Cog): async def reset(self, ctx: commands.Context) -> None: """Resets previous questions and scoreboards.""" self.scoreboard.view = ScoreboardView(self.bot) - for question in self.questions.questions: + all_questions = self.questions.questions + self.questions.view = QuestionView() + + for question in all_questions: if "visited" in question.keys(): del question["visited"] + self.questions.questions = list(all_questions) + success_embed = Embed( title=choice(POSITIVE_REPLIES), - description="The scoreboards were reset and questions marked unvisited!", + description="The scoreboards were reset and questions reset!", color=Colours.soft_green ) await ctx.send(embed=success_embed) |