mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Change score display
This commit is contained in:
parent
56ebf58ce0
commit
170b8caf2d
3 changed files with 11 additions and 2 deletions
|
@ -47,6 +47,7 @@ class TriviaCommand(Command):
|
|||
correct_answer: str = question["correct_answer"]
|
||||
wrong_answers: typing.List[str] = question["incorrect_answers"]
|
||||
answers = [correct_answer, *wrong_answers]
|
||||
if question["type"] == "multiple"
|
||||
random.shuffle(answers)
|
||||
# Find the correct index
|
||||
for index, answer in enumerate(answers):
|
||||
|
@ -101,7 +102,7 @@ class TriviaCommand(Command):
|
|||
else:
|
||||
results += self._wrong_emoji
|
||||
answerer.trivia_score.wrong_answers += 1
|
||||
results += f" {answerer} ({answerer.trivia_score.correct_answers}|{answerer.trivia_score.wrong_answers})\n"
|
||||
results += f" {answerer} ({answerer.trivia_score.correct_answers}/{answerer.trivia_score.total_answers})\n"
|
||||
await data.reply(results)
|
||||
del self._answerers[question_id]
|
||||
await asyncify(self.interface.session.commit)
|
||||
|
|
|
@ -25,5 +25,13 @@ class TriviaScore:
|
|||
def wrong_answers(self):
|
||||
return Column(Integer, nullable=False, default=0)
|
||||
|
||||
@property
|
||||
def total_answers(self):
|
||||
return self.correct_answers + self.wrong_answers
|
||||
|
||||
@property
|
||||
def offset(self):
|
||||
return self.correct_answers - self.wrong_answers
|
||||
|
||||
def __repr__(self):
|
||||
return f"<TriviaScore of {self.royal}: ({self.correct_answers}|{self.wrong_answers})>"
|
||||
|
|
|
@ -1 +1 @@
|
|||
semantic = "5.0a44"
|
||||
semantic = "5.0a45"
|
||||
|
|
Loading…
Reference in a new issue