Commit Graph

190 Commits

Author SHA1 Message Date
Ivo Julca
ce9cdecafd Drop commands sent to rooms from outside 2016-09-17 19:42:15 -05:00
Guangcong Luo
2deac04593 Add timestamps to mod commands
Messages noting warns, locks, etc now have timestamps, and can notify
and be highlighed on and all that.
2016-09-17 08:12:06 -07:00
Guangcong Luo
0fa6220e60 Alias /COMMANDhelp to /help COMMAND 2016-09-17 01:56:45 -07:00
Guangcong Luo
6b4eaf9422 REALLY support commands in PMs
These changes were supposed to be in de524c1a26 but got lost in my
Git stash...

Once again, this is very experimental code; please don't base any
serious changes on it.
2016-09-17 01:16:56 -07:00
Guangcong Luo
03b9a35f55 Fix tests
A recent refactor of CommandParser broke a test.
2016-09-14 16:41:51 -07:00
Guangcong Luo
a2ce260fb0 Fix /me in new command parser
Closes #2744
2016-09-13 14:06:00 -07:00
Guangcong Luo
310fdaa898 Refactor out Room#chat
Room#chat has now been folded into CommandParser.parse.

User#chat now directly calls CommandParser.parse, saving a line of
stack, and eliminating a function that never did much, really.
2016-09-12 19:01:35 -07:00
Guangcong Luo
6f53fcff3a Remove User#broadcasting
This flag seems like it's no longer used for anything, and leads to
weird bugs.
2016-09-04 00:02:22 -05:00
Taylor Everding
1a1f64fe95 Remove .js extension from requires (#2725) 2016-08-30 00:04:40 -05:00
Bär Halberkamp
55429ed884 Move modlog writing to Room.prototype (#2700)
* Move modlog-related functions to Room.prototype, instead of CommandParser

* Wifi: modnote the winner of a giveaway
2016-08-18 16:45:53 -05:00
panpawn
9524e5b5ed Remove unused variable in checkFormat (#2688)
Fix mistake from bbe17f7316
2016-08-10 20:02:45 -05:00
panpawn
bbe17f7316 Refactor command-parser checkFormat function (#2687)
(Also, let's fix /stretching and /capitals help commands while we're at it)
((...And a few typos in the roomsettings plugin...))
2016-08-10 15:15:32 -05:00
panpawn
1a813d3339 Implement stretching/caps checks (#2659)
Before, PS often relied on bots to handle moderating users who send messages that contained too many capitals or stretching.
This should be something that's preventative, not reactive, which is what this does.

Now, bots are no longer needed for these purposes as this allows stretching/caps punishments to be prevented, server-side.
2016-08-02 02:56:37 -05:00
panpawn
32005690c3 Implement slowchat system (#2657)
This is basically a system that allows for room moderators or higher to set a minimum time between a user's messages sent to the room.
This is especially helpful for times the server might be lagging or the chat is just moving much too fast.
Alternatively, this could also help to stop spammers in their tracks and give staff more time to handle them as well.
2016-07-31 19:07:09 -05:00
Guangcong Luo
3681ccfbc1 Implement /addhtmlbox
Bot-specific command to add an infobox.
2016-07-20 21:03:08 -04:00
Konrad Borowski
85ac3d2541 Fix behaviour of modchat with tour room auth 2016-07-07 21:56:47 +02:00
Guangcong Luo
fc9ef55564 Fix CommandContext constructor 2016-07-06 09:21:11 -05:00
Guangcong Luo
7fbbd62d0c Fix ipban/rangelock
The naming are now consistent: /rangeban and /banip both work, as
do /rangelock and /lockip.

In addition, they no longer crash the server and mostly do what
they say they do.

Locking/banning hosts is no longer supported, because it's too much
code for something no one needs to do.
2016-06-26 17:11:09 -07:00
Ivo Julca
b069962913 Store async commands being broadcast 2016-06-03 05:59:37 -05:00
Ivo Julca
3ae533e417 Fix admin-level modchat 2016-06-02 03:05:41 -05:00
Ivo Julca
694b70f19e Support edition of multiline commands whitelist on runtime 2016-05-29 18:32:13 -05:00
Ben Davies
dd9f5f4a74 Fix crash in /hotpatch with compiled .node modules (#2569)
Modules compiled using node.js' addons API do not get added to
require.cache and will make /hotpatch crash if any of them happen to
have been required when it is called.
2016-05-25 16:28:14 -04:00
Guangcong Luo
4a995350bb Shim Array#includes
This also refactors everything to use Array#includes except data
and mods, which are large enough that I'll refactor them later
probably.
2016-05-04 02:55:18 -07:00
Guangcong Luo
cdc9bb5f10 Don't apply banwords to PMs
This includes a slight refactor to banwords.
2016-05-02 22:47:17 -04:00
Guangcong Luo
0ee1b95d78 Adapt message length limit for long characters
This currently only affects bismillah, but we can add other characters
if those get abused, too.
2016-04-22 10:49:51 -04:00
Bär Halberkamp
aa1f6a137a Add a banwords feature (#2503) 2016-04-21 18:24:27 -07:00
SolarisFox
03311bf31b Remove character limit on !htmlbox (#2514) 2016-04-16 22:48:56 -07:00
Guangcong Luo
2bffee7112 Require /globalpromote instead of /promote
Commands like /promote and /[rank] no longer work; instead we require
/globalpromote and /global[rank]. This should cut down on people who
accidentally globally promote someone they meant to room-promote.
2016-04-08 02:45:37 -04:00
Guangcong Luo
0125d90d8a Fix inputUsername bug in splitTarget 2016-04-08 02:45:37 -04:00
Ivo Julca
10bb83bf3c Improvements to command broadcast API
- 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.
2016-04-02 15:46:13 -05:00
Bär Halberkamp
65686aa9f9 Fix another (quite crucial) mistake 2016-04-01 01:37:11 +02:00
Bär Halberkamp
ac8f89b15e Fix canBroadcast again
Making it work when called with checkOnly first then without after
2016-04-01 01:16:56 +02:00
Guangcong Luo
5d23be1ca3 Support multiline errorReply 2016-03-31 19:07:31 -04:00
Bär Halberkamp
a0caee2a07 Fix this.broadcasting not being set in the datasearch commands 2016-04-01 00:52:16 +02:00
Ivo Julca
a7fbc7e96f Fix hotpatch
Properly uncache children modules.
2016-03-23 17:40:17 -05:00
Bär Halberkamp
365462a85c Dexsearch: Correctly broadcast dexsearches 2016-03-20 04:43:42 +01:00
Guangcong Luo
19a3bf307b Export CommandContext from command-parser 2016-03-15 18:19:20 -04:00
Guangcong Luo
447aed29ca Fix style error 2016-03-12 05:32:24 -06:00
Guangcong Luo
97b89cc4ac Refactor CommandContext to ES6 classes
Context in command-parser.js has been renamed CommandContext and
refactored to use ES6 classes. Its also subsumed the canTalk
function. Future iterations will probably put the parse function
inside it as well.
2016-03-12 06:22:59 -05:00
Ivo Julca
66c00d29af Remove usage of String|Number methods implemented by Sugar.js
Implements Tools#toDurationString to replace Number#duration.
2016-03-09 16:55:40 -05:00
Ivo Julca
0281176fd1 Remove usage of Array|Object methods implemented by Sugar.js
Adds a dependency to shim Object.values until it's natively available.
2016-03-09 16:55:34 -05:00
Guangcong Luo
9f3336fc5a Fix /me 2016-02-29 04:10:37 -05:00
Guangcong Luo
0c0b94c01a Support muting offline users 2016-02-29 02:10:49 -05:00
Guangcong Luo
847878038c Autorewrite /me's to /mee 's
You can think of this as now supporting any punctuation after /me, not
just a space.
2016-02-29 02:08:37 -05:00
Guangcong Luo
e54fe99e37 Refactor Context#getLastIdOf to User#getLastId
Also add a User#getLastName

These functions allow punishment commands to show a user's userid
even if they try to avoid that by logging out.
2016-02-28 03:25:35 -06:00
Guangcong Luo
2d7b449a2c Emergency fix for /constructor 2016-02-21 17:35:04 -05:00
Guangcong Luo
b665660608 Refactor for more ES6 features
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.
2016-02-10 17:40:21 -06:00
Guangcong Luo
8a8838552d Improve crashlogger
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.
2016-02-04 03:04:05 -06:00
Marty-D
a088853208 Filter more zalgo-like characters 2016-01-02 17:25:54 -05:00
Konrad Borowski
81f602b8d8 Always use trailing comma for multiline objects 2016-01-01 00:20:07 +01:00