Commit Graph

253 Commits

Author SHA1 Message Date
Guangcong Luo
3763ef80ea Make !om search less spammy
This is the source of the infamous !om g issue.

The new design looks better, anyway, and allows !formatshelp to also
be braodcast since it's no longer spammy.

!om searching will also now only search OMs.
2016-09-26 17:25:53 -04:00
Quinton Lee
3822e0c96a Update guide links in /roomhelp 2016-09-26 15:44:20 -05:00
Guangcong Luo
ed08b145fc Update roomhelp permissions
Can now only be broadcast by ROs, leaders, and admins

Closes #2784
2016-09-25 23:47:00 -04:00
Guangcong Luo
3c5525c8b0 Fix more crashes in PM refactor 2016-09-25 16:22:28 -04:00
Guangcong Luo
5a16c884da Fix a variety of bugs in PM commands
Most of these were introduced in the PM refactor, but an honorable
mention goes to the global command regex.
2016-09-25 14:12:43 -04:00
Guangcong Luo
1427871a09 Refactor Messages
PMs no longer special-case commands. The implementation of /invite,
/me, etc in commands have been fully moved from messages.js back to
commands.js and the rest. This makes Messages command support a lot
closer to how CommandParser itself handles commands; the two files
should be mergeable soon.

/me has been refactored, and now supports /ME, /me's, etc in PMs and
regular chat exactly the same way.

context.pmTarget is now guaranteed to be `User|undefined`, rather than
its previous specification of `User|string|undefined`. The previous
use-case of putting a string in context.pmTarget was to support
errorReply when PMing a nonexistent user, but special-casing that
case is easier than having to support a possible string pmTarget
everywhere.
2016-09-24 23:14:16 -07:00
Guangcong Luo
398dcf93ad Update /roomhelp
Replace /modchat with /roomsettings, and rephrase Tours link, and bold
some headers.

Closes #2764

Closes #2640
2016-09-24 23:14:16 -07:00
Bär Halberkamp
c6814a384d Properly support custom room punishments 2016-09-24 22:49:51 +02:00
Ben Davies
a88825e55f CommandParser: register global command aliases, optimize TestPattern registration (#2777)
Aliases like /j used to not work when called from the global room while not in
lobby.

Using rest parameters for TestPattern#register instead of a
single array came out to be faster.

/roomtopic also isn't a command.
2016-09-23 19:50:56 -05:00
panpawn
eaadd1fd44 Fix broken permission with /htmlbox (#2766)
This now makes it so that if a user can broadcast but cannot declare in that room, and they attempt to broadcast it, it will now send them the error reply themselves instead of broadcasting the error reply to the room.

Credits to Slayer95 for this fix!
2016-09-22 20:56:07 -07:00
czn-PS
585d7422fd /htmlboxhelp: Update requirements (#2759) 2016-09-20 09:02:04 -07:00
Ivo Julca
ce9cdecafd Drop commands sent to rooms from outside 2016-09-17 19:42:15 -05: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
8367425694 Fix bugs in roomban/blacklist refactor
- /ip would display "undefined" for rooms a user isn't banned/muted in
- CrisisMonitor would report private roombans/blacklists
- Roombans/blacklists would alert for rooms you're not in
- There were crashes in /mute and /hidetext
2016-09-16 20:20:32 -07:00
Guangcong Luo
05ae323fcd Refactor roombans/blacklists
Roombans/blacklists have been mostly rewritten from scratch.

The new code mostly uses the same patterns as global punishments.

In addition:
- /ban has been renamed /globalban
- globalbans and blacklists now require a reason
- bans and blacklists in public rooms now show up in global modlog
- blacklist syntax is different: /blacklist and /unblacklist
- ban/blacklist display in /whoare is now more detailed
2016-09-16 10:27:26 -07:00
Guangcong Luo
7a7b46bc1e High priority blacklists fixes
This isn't all the work that needs to be done on blacklists, but it's
the highest-priority changes.

- blacklists.tsv has been renamed room-punishments.tsv
- The format everywhere has changed to roomid:userid, rather than
  roomid|userid
- roompunishments.tsv's format is now `Room ID:User ID, IPs and alts`
  rather than `User ID, Room ID|IPs and alts`, which is more sane and
  also cuts down on repetition of room IDs

Those are the changes that affect storage format, which are highest
priority because I don't want to support the previous format.

Other changes include:
- Punishments.roombannedIps renamed to Punishments.roomIps
- Punishments.roombannedUserids renamed to Punishments.roomUserids
- Some refactoring for ES6 destructuring
- Various bugfixes
2016-09-15 06:10:54 -07:00
Bär Halberkamp
28c0a2a22c Rewrite roombans to be timed as well (#2545)
Also implement blacklists
2016-09-15 04:35:00 -07:00
Ben Davies
d9c6fe54b2 ProcessManager: subclass to extend ProcessManager, unit tests setup (#2739)
Before, an options object containing properties and values to be used
was how decorated instances of the class would be created. This meant
the constructor could assign anything you feel like to `this`. Rather
than that, the constructor now assigns a strict set of values, and
methods are redefined in subclasses.

Basic unit tests were added to test if they could be written for after
the final refactor to fix the other memory leak here.
2016-09-09 15:51:49 -05:00
panpawn
6107b2b574 Whois: Don't display negative expire times (#2741)
Before, if a user was perma locked or perma banned, it would show that their lock would expire in a negative time - this fixes that.

For consistency, I also added the check to the namelock check as well.
2016-09-08 21:24:05 -05:00
Guangcong Luo
54b672fe4e Start refactoring for template strings
This commit introduces Tools.html and Tools.plural, helper functions
for string construction.

Tools.html is a template tag function that escapes HTML inside the
template string.

Tools.plural is a helper function that takes a passed Number, Array,
Set, or Map and returns a string representing whether or not it's
plural.

It also starts doing some refactors of some files to make it clear how
I expect code style for template strings to look.

Previously, we used ' for IDs, " for English text, and ' for code.

We should now be using ' for IDs, ` for English text, and ` for code.
2016-08-28 04:35:43 -05:00
panpawn
dcaac974b5 Allow regular users to do /htmlbox (#2714)
This lets regular users, or users who don't have permission to use !htmlbox to first test and validate HTML by using the same validation system PS uses across the sim for things like roomintros, for example.
2016-08-24 17:25:45 -05:00
Guangcong Luo
ac683eb008 Show namelock status in /alts 2016-08-22 17:42:39 -04:00
Guangcong Luo
be75115e49 Refactor Users#roomCount to Set
Users#roomCount, previously a null-prototype roomid:count Object,
is now Users#inRooms, a roomid Set.

The new name is "inRooms" rather than "rooms" mostly for ease of
greppability. I'm kind of tired of getting Rooms.rooms when
grepping for ".rooms"

This is the next step in the process of using Maps/Sets instead of
null-proto Objects for maps/sets we add/remove to/from a lot.

I tried to get rid of the room counter completely, but that made
iterating a user's rooms take tens of milliseconds rather than
tens of microseconds, which is unacceptably slow for how often we do
that.

Not actively tracking the number of connections in a room does not
change the asymptotic complexity of any function. It slows down
leaveRoom but doesn't change its asymptotic complexity (nor does
it slow it down in any noticeable way).

leaveRoom was, incidentally, kinda gnarly code which is now a lot
cleaner. Yay!
2016-08-22 03:57:08 -05:00
panpawn
e3eaa80681 ipsearch: Make "No results found." a sendReply (#2704)
#Zarel: >No results found.
#Zarel: why is that red???
%panpawn: I don't know
%panpawn: it was red before that commit
#Zarel: Should probably be sendReply for "No results found"
2016-08-20 04:38:33 -05:00
panpawn
9bffc2f865 ipsearch: Add an errorReply due to invalid search (#2696) 2016-08-20 03:50:54 -05:00
Guangcong Luo
4935904d04 Refactor /alts to use getAltUsers
Fixes an obscure issue where a past alt name has been reused and no
longer properly redirects.
2016-08-12 18:45:15 -04:00
Guangcong Luo
088c23bd62 Refactor Dnsbl.reverse to use Promises 2016-08-07 21:08:18 -05:00
panpawn
9fdb7ed971 Fix issues with pminfobox & addhtmlbox commands (#2676)
- The line that we're removing from pminfobox was checking a character limit, which isn't ideal when we're using HTML.
- The fact that bots can always use /addhtmlbox even when they aren't able to talk is a potential security issue, so we're adding a check to prevent that.
2016-08-06 20:02:13 -05:00
panpawn
36d7728b06 Update help commands to reflect new bot rank (#2634)
Also, give the bot rank the new addhtml permission in config/config-example.js

... And, we are going to fix promoting locked users to rank bot.
2016-07-20 19:50:47 -06:00
panpawn
cbcbfad56e List the new bot rank in /groups (#2633) 2016-07-20 19:50:16 -06:00
Guangcong Luo
3681ccfbc1 Implement /addhtmlbox
Bot-specific command to add an infobox.
2016-07-20 21:03:08 -04:00
panpawn
5858c809c9 Implement bot rank (server-side) (#2632)
This was inspired by https://github.com/Zarel/Pokemon-Showdown/pull/2471

We are also removing the github-specific code from /htmlbox as well, removing the modchat alias of * for player, and we are giving room owners and leaders the roombot permission so they can promote to it.
2016-07-20 16:47:37 -06:00
urkerab
9ceac3768d Show the contest condition as one of the move's details (#2625) 2016-07-16 15:35:57 -06:00
Bryan AA
5e73377c15 Use errorReply instead of sendReply in necessary cases (#2620) 2016-07-11 22:47:49 -04:00
Hidden50
3c18b58817 Add "muted in" to /whoare (#2600)
Lists the rooms that a user is muted in: http://i.imgur.com/xaO8sCx.png

Similar to "banned from", this can be useful to determine if a user is
hitting multiple rooms.
2016-06-27 15:23:55 -07:00
Guangcong Luo
a8fa6b15e4 Fix crash in /host 2016-06-23 19:50:57 -04:00
Guangcong Luo
76b0611dc9 Show lock/ban reasons in /whoare 2016-06-17 04:43:07 -04:00
asgdf
18768f9a39 Allow non-broadcasted use of /roomhelp in lobby/battles (#2587) 2016-06-16 06:19:19 +02:00
Guangcong Luo
37f880e9fc Suppress constructor errors
Unless we want to change the syntax for data tables like pokedex.js,
'constructor' will always exist as a table key.

These changes represent the bare minimum to prevent this from
causing too-weird behavior.
2016-05-11 05:07:02 -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
Quinton Lee
78ae2e526f Update /faq and /intro (#2533)
The on-site FAQ and beginner's guide have been moved to a forum thread
to ease maintenance. This removes several entries from /faq because you
can't link to specific sections of a forum post. Unmatched targets now
link to the general FAQ post instead of giving error messages for
somewhat backwards compatibility with removed entries.
2016-04-23 23:42:26 -07:00
Guangcong Luo
58a306d7f9 Add roomauth to /whois
This updates /whois to match the trainer card.
2016-04-13 05:41:46 -04:00
Marty-D
894bc54fef Info: Fix /details display for falsy values 2016-04-08 14:35:03 -04:00
Juanma Serrano
6e51f4aaf0 Smogdex command: Proper link for battle spot singles 2016-04-06 10:51:52 +02:00
Juanma Serrano
01a6879cd1 Update /smogdex help
It didn't mention you can specify tier
2016-04-05 16:52:29 +02: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
Juanma Serrano
77e0a17082 Update /git command: it's only node.js now
io.js has been merged into node.js anyway and all information leads to node.
2016-04-01 11:20:43 +02:00
Ivo Julca
f901bfe31e Fix data load in informational plugins
- Single-process `datasearch` requires mods.
- `info` requires Gen 6 data.
2016-03-31 16:50:50 -05:00
Ivo Julca
6173d622d4 Info plugin no longer requires mod data 2016-03-31 14:01:17 -05:00
Bär Halberkamp
0e206dcd42 Make /learn multiprocess using the same process as /ds 2016-03-31 15:59:36 +02:00