Due to the recent refactor that changed how `this.canTalk` works, if a user was muted in a room, and then tried to do a command that wasn't allowed to be used if they can't talk, it would send two replies: "You are muted and cannot talk in this room." AND "You cannot do this while unable to talk."
This makes it so that if you're using a command while muted that isn't allowed to be used if you can't talk, it will just use the "You are muted and cannot talk in this room." errorReply.
Now users can search for questions/submissions without having to rummage
through the entire list of questions. Trivia data and its writer are exported
once more so edits can be made to it with /eval if necessary.
We had a lot of discussion in Dev and a somewhat-close poll, but in
the end "Chat" was a better name than "Messages", and also has the
advantage of being shorter (which is nice for Chat.html and
Chat.plural which should be short).
The following functions have been renamed:
- Tools.html to CommandParser.html
- Tools.plural to CommandParser.plural
- Tools.escapeHTML to CommandParser.escapeHTML
- Tools.toDurationString to CommandParser.toDurationString
- Tools.toTimeStamp to CommandParser.toTimestamp
(notice the lowercase 's')
This is in preparation for a rename of Tools to Dex (by removing the
non-dex-related functions) and a rename of CommandParser to either
Messages or Chat.
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