aboutsummaryrefslogtreecommitdiffstats
path: root/bot/constants.py
diff options
context:
space:
mode:
authorGravatar Shivansh-007 <[email protected]>2021-09-07 16:41:27 +0530
committerGravatar GitHub <[email protected]>2021-09-07 04:11:27 -0700
commitedb80b90186b7ebfcce8b3dae55fedb62a77b912 (patch)
tree05072d2057bc592f71ce9e2be64ff634e61fc1d0 /bot/constants.py
parentCI: check license compatibility (#855) (diff)
Wikiguess Game (#618)
* (trivia-quiz): Add Wikipedia Guess Game This commit also moves all the 'dynamic' question generator to a separate class. Closes: #446 * (trivia quiz): Use tuples for command aliases * (trivia quiz): Edit congratulations message * (trivia quiz): Use default dict for storing player scores * (trivia quiz): 'done_question' to 'done_questions' * Add space after 'Congratulations' word * Use classmethods for dynamically generating questions * Don't add wiki category if max error fetches hit If the task hit max error fetches, which is 3 currently, it would remove wikipedia from listed categories and not add it to loaded questions. If it doesn't hit max fetches, then it adds them. * Don't hardcode the number of questions in RULES * Add information field only if it exists * Add "cs" and "python" categories to the `.quiz` command * add 30 questions each under the categories "cs" and "python" add the two categories into the code and modify the starting phase Co-authored-by: Xithrius <[email protected]> Co-authored-by: ToxicKidz <[email protected]> * refactor: Use yesterday's most read to make trivia questions Since random wikipedia article guess questions weren't really "knowledgeable", no one could really guess it or gain any "good" knowledge from them, so after asking wookie (this commits mentions his review comments above also), I decided to use these. * refactor: Logic to remove pronounciations from question Co-authored-by: wookie184 <[email protected]> * fix: Set to correct question limit If the number of questions are less then the default limit which can happen in the case of wikipedia guess game as it is dependent on the most read articiles on wikipedia, it would create a infinite loop sending us into infinite amount of errors, so let's prevent that, thanks wookie * chore: Add comment for d5f8205 change * refactor: Remove double mention of dataclass in quizentry * chore: Use r"" over noqa We can use r"", a raw string, here to make it clear that \* and \s aren't supposed to be handled as escape sequences and just use the "raw string". * fix: Correct off by one bug Originally, before this commit, we checked the number of questions left by comparing `len(done_questions) > self.question_limit`, so question limit had to be 1 since if it wasn't we would compare 7 > 7, which would be false and then it would send another question. To correct this bug, we now use == comparision on the two, so if the number of done questions is same as the question limit it means that the round is over. I have changed the relevant parts of the code to reflect this change i.e. where-ever we did +-1 due to the off by one bug. * refactor: Noramlize the title to remove all punctuations Since the title can sometimes contain punctuations making it very difficult to get the matching answer to the question, we originally removed all such questions. This took the question count down :( and wasn't an effective way. Therefore now we keep them but as normalized, yay! I have also updated the code documentation to make the process much clearer to anyone reading the "normalizing" code section of the wiki questions generator. * refactor: Keep answers as a list & not ",".join() Wasn't fitting in character limit so shorterned it ^^ lol. Okay, getting to the point, this mentions fix error's comment of making quiz entry except the answers as a list and not as a string which could a comma joined list. The same structure was in the json resource, where multiple answers where joined with commas. This didn't allow you to use commas in answers. So I went ahead and did a bit more than requested to change the json structure and make `answers` a list. Also now all questions are in the form of the quiz entry to keep it same through out the code and var tolerance has become a valid param in QuizEntry, this is done because it was differing between questions, if not needed this would make the process to add `var_tol` as a argument to the json easier. And that's it! Co-authored-by: Objectivitix <[email protected]> Co-authored-by: Xithrius <[email protected]> Co-authored-by: ToxicKidz <[email protected]> Co-authored-by: wookie184 <[email protected]>
Diffstat (limited to 'bot/constants.py')
0 files changed, 0 insertions, 0 deletions