The writer functions held circular references to themselves due to their
finishWriting closure. Because the bug that required making an exception
for how files are written on Windows was fixed 4 years ago now
(nodejs/node-v0.x-archive@41f2725), it's perfectly safe to remove the closure
and break the reference.
- /trivia status no longer crashes if a username is provided as a target
- Timer mode no longer gives users scores of NaN
- /trivia start no longer displays that the game is starting in 30000 seconds,
- rather than 30 seconds
- Questions no longer appear as escaped html during games
- Corrected misleading documentation on why the noop methods of trivia exist.
Part 1 of the rewrite for the entire plugin
This is the rewrite of the classes and commands that handle running
trivia games. Several bugs that happened when running trivia games were
fixed, and unit tests were added to help keep them gone.
- Method `this.runBroadcast()` has been split from `this.canBroadcast()`.
It's now the only method handling command-usage and intended as the main API
for synchronous commands. Async commands will execute both separately.
Note that the `suppressMessage` parameter is now passed to `runBroadcast`.
- The semantics of `broadcasting` have been similarly split.
`this,broadcastMessage` will be set to a truthy value when `this.canBroadcast` is run.
`this,broadcasting` will only be set to `true` once `this.runBroadcast` is executed.
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.
This refactor:
- uses arrow functions where appropriate
Note that arrow functions still aren't used in Mocha, where `this`
is sometimes meaningful.
This also removes the need for .bind() nearly everywhere, as well
as the `self = this` trick.
- refactors Validator and Connection into ES6 classes
- no longer uses Array#forEach for iterating arrays
We strongly prefer for (let i = 0; i < arr.length; i++) because of
performance reasons. Most forEaches have been replaced with for..of,
though, which is 5x slower than the long-form loop but 2x faster
than forEach, which is good enough outside of most inner loops.
The only exception is tournaments, which is due for a more invasive
refactor soon anyway.
- /trivia kick did not update responder indices if a player that
answered correctly was kicked, which timer mode depends on
- /trivia qs no longer lists random and undefined as categories
- Remove question sorting on loading the Trivia plugin, since it is no
longer required
- Trivia game winners are chosen based on who answers first, not who
signs up first
- The Artist of the Day is no longer always the first artist to be
submitted
- Replace instances of foo > -1 with foo >= 0
Letting users that can't talk use the more important commands is fine
and all, until they find a way to spam with them.
- Remove redundant this.canBroadcast call in /aotd
- The response after changing the Quote of the Day uses the proper
broadcast style
- /aotd viewnoms sorts the prenomination list
- /trivia qs acknowledges that Video Games is a category
- Change suggestions to use the deprecated /trivia help command to /help
trivia
- Add style fixes used in the Trivia to the The Happy Place and The Studio
plugins
Binary searches are now used instead of linear ones when splicing
questions in and slicing all the questions in a category from the
questions arrays. Stalemates are now handled after scoring answers
instead of just before asking a question.
- the ladder is now saved in triviadata.json, and gets updated at the
same time ranks do instead of needing to loop through the leaderboard
once more
- Trivia.inactivityCounter clears properly on answer
- number and timer modes accept multiple answers again
- added question and intermission timeout consts
- Trivia property names are more specific
- /trivia rank now shows the user's rank for each of the three score
types
- Add /trivia ladder
- Fix crash in timer mode scoring
- Fix /trivia submit excluding all but the first answer in certain cases
- Fix /trivia accept and reject
- Consistent object notation
- participants are now stored in a map
- part of the score calculations are now handled on answer, rather than
all of them being done when the answering period ends
- the responders object has been removed in favour of storing more
information in participants
- /trivia qs with no argument returns question statistics
- some slight optimizations in the question commands
- /trivia help is now less verbose
- the code is now much more legible