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.
Crashlogger now supports passing in a dictionary of additional
information to report, so we no longer need to resort to making fake
errors.
The hadException parameter has now been removed entirely. I don't know
of a use case for it to be false.
Most images are hosted in places that already support HTTPS, so all
we need to do is transparently rewrite them to be protocol-local.
For the rest, I don't care enough to enforce HTTPS on them. At
least wait for browsers to complain more about it...
If a room is under modjoin, /invite will try to roomvoice a user who
doesn't already have permission to join the room.
This feature is pretty rudimentary and only works if the modjoin
setting is `+`, but I'm 80% sure it's better than nothing.
Fixes the long-standing issue of bad interaction between `this.parse('!command')` and `this.canBroadcast()`: each time the latter was called, it would announce the command usage.
The old `.message` is dropped, and the new `.message` is the old
`.originalMessage`.
Having a fake `.message` pretending a namespace command is a
top-level command seems entirely unnecessary, so I still don't
really understand what it's for in the first place.
this.errorReply sends a red error message inline. The main special
thing is that it takes advantage of our new /error support in PMs to
send inline errors in PMs as well.
This was done by applying chat plugins to the cloned commands
object rather than the original, which should probably have been
done in the first place.
The modlog API is now accessible from outside of CommandParser
through CommandParser.writeModlog.
We now also have a concept of a global modlog, and some new
command APIs for writing to it.
These are commands from commands.js, before they're possibly
overwritten by other chat commands. It's a shallow copy so memory
impact will probably be minimal.
- Return proper error message for forbidden commands.
- Fix a recursive crash in lobby-less servers.
- Fix a stack overflow in some (very stupidly) modded servers.