Commit Graph

118 Commits

Author SHA1 Message Date
Guangcong Luo
77dfc68445 Unlink/hide spammer usernames through renames
This also adds a new variable from .splitTarget, .inputUsername,
which represents the username before following the user through
renames.
2015-07-18 14:31:41 -04:00
Guangcong Luo
d206d3cc28 Allow admins to talk in private modchat rooms 2015-07-18 14:31:41 -04:00
Ivo Julca
cea3a13c11 Fix API to parse broadcast commands
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.
2015-07-14 04:40:32 -05:00
Guangcong Luo
57de9bacc9 Fix // becoming /// in command parser 2015-07-13 04:03:02 -04:00
Guangcong Luo
c5818939c8 Fix leading space getting around command permissions 2015-07-12 05:03:35 -04:00
Guangcong Luo
cdf0c2573d Use .id instead of .filename in uncacheTree 2015-07-02 03:42:07 -04:00
Guangcong Luo
bed5a46ff3 Improved command identification
! followed by a non-alphanumeric character is no longer recognized
as a command.
2015-06-30 22:35:31 -04:00
Guangcong Luo
c77f1b2ef7 Refactor namespace support 2015-06-30 21:12:12 -04:00
Guangcong Luo
806f003863 Use errorReply for command parser errors 2015-06-30 21:12:12 -04:00
Guangcong Luo
4c852e713f Drop support for returning /text from a command
Previously, this was used as a way to recurse from Config.chatfilter,
but Config.chatfilter is passed a Context now, which makes this
unnecessary.
2015-06-30 21:12:12 -04:00
Guangcong Luo
222bc48aa9 Drop support for Context#originalMessage
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.
2015-06-30 21:12:12 -04:00
Guangcong Luo
2c7ad95635 New command API this.errorReply
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.
2015-06-30 03:09:02 -04:00
Guangcong Luo
0aff3445a5 Pass command context to Config.chatfilter 2015-06-30 03:05:29 -04:00
Guangcong Luo
89535e95b9 Fix crash when shadowing commands.js commands
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.
2015-06-30 03:01:55 -04:00
Guangcong Luo
9529644e0b Fix crash in globalModlog 2015-06-29 01:56:02 -04:00
Guangcong Luo
7419a03626 Modlog refactor
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.
2015-06-27 22:35:31 -04:00
Guangcong Luo
53516692ec Export CommandParser.baseCommands
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.
2015-06-27 22:32:51 -04:00
Guangcong Luo
e6d952b035 Clarify command-not-found message
The previous text implied that it was possible to send !command
without broadcasting. This isn't actually possible.
2015-06-25 17:53:40 -04:00
Ivo Julca
2db4b6bf44 Misc command parser fixes
- 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.
2015-06-24 20:49:39 -05:00
Ivo Julca
9b1b078534 Command API: this.run executes a command with current parameters
- Provides a straightforward way to add command aliases with own help entries.
- Encapsulates try-catch blocks.
2015-06-24 18:35:58 -05:00
Ivo Julca
00640a5218 Command API: this.cmdToken is either '/' or '!' depending on input
Also adds feature parity for !commands to be escaped with double !,
and to be returned from `canTalk`.
2015-06-24 18:35:33 -05:00
Ivo Julca
214fd79fdf Refactor command context creation to use a prototype
Also support custom extensions to command API from plugins.
2015-06-24 18:34:16 -05:00
Guangcong Luo
b792fa64e9 Merge pull request #1867 from SolarisFox/patch-7
Mute refactor
2015-06-16 07:40:57 +00:00
SolarisFox
09be77d0b8 Mute refactor 2015-06-14 00:16:44 -07:00
Guangcong Luo
0450e7d9c9 Support writing to other rooms' modlog
Apparently modlog is in CommandParser, which doesn't make it very
straightforward to access outside of the this. functions in
commands. This change at least makes it possible to write to
other rooms' modlogs in commands, but in the long term we might
want to move modlog from CommandParser to Rooms, or at least
expose an API accessible outside of commands.
2015-06-12 03:28:46 -04:00
Guangcong Luo
665ef46145 Improve PM support in Config.chatfilter
The user the PM is being sent to is now passed to .chatfilter
(and canTalk et al).
2015-06-05 13:22:53 -04:00
Guangcong Luo
621328c18d Optimize canTalk a bit 2015-05-27 14:37:17 -04:00
Ivo Julca
4222ffb5df Dependant support: make sure that relative paths are resolved properly 2015-05-11 15:38:18 -05:00
Guangcong Luo
c333cb8aad Add basic tag-matching validator to canHTML
This gives commands like !htmlbox and /roomintro a basic validator,
to warn about typoes related to mismatched HTML tags. This is NOT
intended to be secure (we have a separate sanitizer client-side for
that), but is intended to guard against user error only.
2015-04-29 00:07:25 -04:00
SolarisFox
336cbc462a Move config/commands.js to chat-plugins 2015-04-25 00:44:07 -07:00
Ivo Julca
b9b4196314 Command crash logs now report full message sent
Accounting for namespaces
2015-04-17 00:46:23 -05:00
Guangcong Luo
461303e466 Disallow 'click here' in roomintros
'Click here' as link text is heavily recommended against, but it's
easy to forget, which makes it a good thing to ban programmatically.
2015-04-17 00:36:17 -04:00
Morfent
ce1724e179 Replace all s.substr(x, 1) with s.charAt(x) 2015-04-06 21:20:43 -03:00
SolarisFox
b3a942aa71 Fix broadcast cooldown message checking.
Include characters that are important to the function of commands.
2015-03-25 22:59:53 -07:00
codelegend
916814de24 remove unused argument in Room#add calls 2015-03-18 22:11:19 +05:30
Guangcong Luo
c10498bcab Merge pull request #1312 from ascriptmaster/modbattle
Private Room refactor - Distinguish hidden and secret rooms
2014-12-23 16:40:52 -06:00
Guangcong Luo
0f2e92ede8 this.parse is global by default
this.parse in chat commands was changed to default to parsing
in-namespace, when namespaces were introduced. This commit changes
it back to parsing globally, with in-namespace parsing being
optional and defaulting to off.
2014-12-23 16:37:57 -05:00
ascriptmaster
fa79202649 Private Room refactor - Distinguish hidden and secret rooms
Seperated /privateroom command into /privateroom and /hiddenroom. In
hidden rooms, mostly set by battle players, global staff maintain their
ranks within the room, but the rank is not kept in secret/private rooms
(only set by users who can create chat rooms).

Created command /whoare to allow global staff to see the hidden rooms a
user is in.
2014-12-22 02:39:50 -08:00
小太
05b3327b91 Add namespace-like functionality to commands
where object command handlers represent a new namespace
2014-12-15 00:33:55 +11:00
Guangcong Luo
1cf90b54ae Update Config.chatfilter API 2014-12-01 16:52:00 -05:00
Guangcong Luo
db09d66039 Update zalgo filter 2014-12-01 16:49:29 -05:00
Guangcong Luo
4c32621593 Reintroduce command crashguard
If a crash happens during a command (which is around 99% of all
crashes), a bug in either Node or SockJS causes the user who issued
the command to be unable to do say or do anything (although they'll
still receive messages).

We used to have a crashguard to prevent this from happening, but
it was removed due to suspicions of being a significant lag source.
Later lag investigation has shown that it's not the biggest source
of lag, so we're reintroducing that crashguard for now.
2014-10-21 16:49:22 -04:00
小太
ae6da14ca0 Misc cleanup
The important fixes from pull request #865
2014-10-12 21:34:59 -05:00
Guangcong Luo
2fbb1d52a3 Optional 'global' for global promotion/demotion
Adds support for adding the word 'global' in front of global
promotion/demotion commands, for instance /globalmod username
to promote a user to global mod.

Also adds /roomdeauth.
2014-10-12 22:13:22 -04:00
小太
5027be79fb Add jscs as a style checker, and add some extra jshint options 2014-09-29 18:38:01 +10:00
Guangcong Luo
4a761b470d Update zalgo filter
Some users were using some zalgo not caught by the current filter.
The new filter fixes that.
2014-09-05 23:16:14 -04:00
Guangcong Luo
34f9137d69 Fix crash when sending '/ ' 2014-09-04 16:19:20 -04:00
Guangcong Luo
0570c0dbcb canTalk now supports returning /command
returning /command will parse the command returned. This is mainly
useful for Config.chatfilter.
2014-08-30 02:12:09 -04:00
Guangcong Luo
7bf6269813 Remove lobby spoiler filter
It belongs in the config chatfilter
2014-08-22 00:35:04 -04:00
Guangcong Luo
b1cd4e81dc New command API sendModCommand
Does the same thing as privateModCommand, but without logging it
2014-08-12 20:42:35 -04:00