Commit Graph

32 Commits

Author SHA1 Message Date
Ben Davies
e8c8e0d9bd Add CommandContext#shouldBroadcast and fix !code permission checks (#6198) 2019-12-28 16:26:50 +09:00
whales
0b9d8dd109 Support declarative roomsettings syntax (#6119) 2019-12-06 23:16:55 +09:00
whales
f7d5cefc7d Refactor tournament plugin loading (#6118) 2019-11-30 17:53:01 +13:00
Guangcong Luo
23f9bfa1b7
Split up server/chat-commands/ (#5943)
`server/chat-commands.js` is now a directory. It's been split into
`core`, `moderation`, and `admin`. `info` and `roomsettings` from
`chat-plugins` have also moved to `chat-commands`.

Some cleanup:

- Bot commands for inserting HTML into rooms like `/adduhtml` have been
  moved from `info` into `admin`.

- `/a` has been renamed `/addline`, for clarity (and also moved from
  `info` into `admin`).

- Room management commands like `/createroom` and `/roomintro` were
  moved to `room-settings`

- `chat-commands/admin` has been TypeScripted
2019-11-15 11:12:54 +13:00
Guangcong Luo
c40a7d2fb2 Allow broadcastable commands in command console
Command consoles previously would silently fail if you used a
broadcastable command (like `/dt` or `/learn`). They are now let
through, although actually trying to broadcast (like `!dt`) will
still show an error message.
2019-11-11 02:13:48 +13:00
Astrid Halberkamp
a3244a7449
Fix URL detection in usernames 2019-11-10 13:23:11 +01:00
Waleed Hassan
28e870c4fb Server: Use readonly where appropriate (#5902) 2019-10-21 16:12:32 +10:30
Astrid Halberkamp
a1d4b420cd
Refactor filters to always use regex (#5859)
* Refactor filters to always use regex

* Update server/chat-plugins/chat-monitor.js

Co-Authored-By: Kirk Scheibelhut <scheibo@users.noreply.github.com>

* Simplify evasion detection regex storage after peach rightfully pointed out how fucking stupid i am

* Put this garbage in adminlog if that room exists

* fix tslint
2019-10-18 21:19:39 +02:00
Lusamine
9d6fbdba41 Fix globalModlog modlogging twice in some cases (#5890) 2019-10-18 09:41:13 +10:30
asgdf
edebcbc4a9 Support loading plugins from chat-plugins/private/ (#5867) 2019-10-14 11:11:37 +11:00
TheMezStrikes
3178912a52 Trim all command arguments (#5865) 2019-10-11 05:32:07 +11:00
whales
ea2dea1283 Rooms: Rooms.get can return null (#5860) 2019-10-09 18:52:33 +11:00
Guangcong Luo
71498d451d
New validator (#5840)
* Refactor validator

This is a major refactor intended to make the default rules easier to
understand, and also easier for OMs to bypass.

Removed rules:
- `Pokemon`: This is now `-Nonexistent`. Its previous name was intended
  to be interpreted as "simulate the Pokémon games exactly, and only
  allow what they allow". The new name should make it clearer that it
  mainly bans CAPs and other nonexistent Pokémon and functionality.
- `-Illegal`: This is now `Obtainable` (see below).
- `Allow CAP`: This is now `+CAP`. Instead of having a hardcoded rule,
  OMs can now be manually whitelist any pokemon/item/etc or group of
  them, overriding `-Nonexistent`.
- `Ignore Illegal Abilities`: This is now `!Obtainable Abilities` (see
  below).

`Obtainable` was previously `-Illegal`, and does the same thing: Makes
sure you have a regular Pokémon game with only Pokémon that can be
obtained without hacking.

But instead of being a ban, it's now a rule that does nothing by
itself, except contain more rules:
- `Obtainable Moves`
- `Obtainable Abilities`
- `Obtainable Formes`
- `Obtainable Misc`
- `-Nonexistent`
- `-Unreleased`

This allows OMs to piecemeal repeal and unban any of these individual
rules, instead of the previous approach of unbanning them all and
manually reimplementing every single validation you wanted to keep.

* Refactor PokemonSources into a class

This mostly just makes a lot of the weirder checks in the validator
substantially more readable.

This also renames `lsetData` to `setSources`, which should also help
readability.

* Validate Bottle Cap HP types

Fixes an issue reported here:

https://github.com/Zarel/Pokemon-Showdown/issues/5742#issuecomment-533850288

* Fix several move validation issues

Fixes #5742

We have a new MoveSource type: R for Restricted. R moves work like
level-up/tutor/TM moves, except you're limited to one R move.

- Shedinja move stolen from Ninjask in Gen 3-4 are now R moves instead
  of event moves. This allows them to coexist with Nincada egg moves.

- Necrozma-DW/DM now inherit moves/events from Necrozma (like Rotom,
  but with event validation). This allows them to be shiny.

- Pokemon can now get egg moves from their own evolutions. This fixes
  some Tyrogue, Charmander, and Treecko sets mentioned in #5742

- Some more C moves were added, fixing some Hitmontop and Chatot sets
  mentioned in #5742

* Improve ability/move compatibility validator
2019-10-06 04:21:30 +11:00
Waleed Hassan
5607c158e4 Use void in promises to appease TSLint (#5827) 2019-10-03 19:08:30 +10:00
Waleed Hassan
da4b887054 Rename Room#id -> Room#roomid, User#userid -> User#id (#5826)
These should make it clearer that userids are IDs but roomids aren't.
2019-10-03 18:57:38 +10:00
whales
31ead12588 Type Chat.tr properly (#5814) 2019-09-25 15:06:12 +02:00
Astrid Halberkamp
c02bd7c53f Chat: fix indentation
TODO: fix my VSC installation so this doesn't happen again
2019-09-25 13:29:35 +02:00
Astrid Halberkamp
35d9cb6ec6 Make canTalk() translatable
Thanks peach for figuring out the absolute hell of a type signature for Chat.tr
2019-09-25 13:27:38 +02:00
whales
cdff583606 Fix blocking PMs (#5797) 2019-09-19 15:05:24 +09:30
whales
4d9e87cd78 Support blockPMs ac / trusted (#5790) 2019-09-17 18:22:40 +10:00
TheJetOU
f51a1f3742 Add CommandContext method for Chat#(status)filter (#5737)
* Add CommandContext method for Chat#(status)filter

* Don't use instanceof
2019-09-15 06:25:54 +02:00
whales
b8114fbae0 Improve username punishments (#5743)
* Improve username punishments

Track how many times a name has been forcerenamed, note differently for offline warns and forcerenames

* Hyperlink names, show trusted/ac/registered

* rebase

* pseudorank -> accountstatus
2019-09-15 06:25:15 +02:00
whales
16551a7c5c Typescript lottery (#5739) 2019-08-30 09:12:49 -05:00
whales
f143d83a67 Refactor Chat to a big class (#5729) 2019-08-27 08:08:33 -07:00
TheJetOU
2b28c9fd6b Refactor Rooms(), Users() to Rooms.get(), Users.get() (#5725) 2019-08-25 06:33:56 -07:00
Jeremy Piemonte
9a2b2fed90 Allow non-ac users to send links in help tickets (#5726) 2019-08-25 05:04:28 -07:00
Guangcong Luo
e0a2cf07e1 Correctly define global types for .ts files
Global types are defined differently for `.ts` files than for `.js`
files, leading to some confusion for past refactors.

This commit defines them correctly.

I'm also considering making certain global types only available under
namespaces, but I don't want to do that to `User` or `Room`, so for
now, there are no changes there, besides putting streams in the
`Streams` namespace (so `WriteStream` is now `Streams.WriteStream`).
2019-08-23 09:33:49 -07:00
TheJetOU
5597916644 TypeScript Rooms and Roomlogs (#5699) 2019-08-14 20:44:57 +02:00
TheJetOU
f586e88326 Simplify Map declarations (#5702) 2019-08-13 17:23:27 +02:00
Kirk Scheibelhut
9ab3f5a668
Make /hotpatch fail if git history hasn't changed (#5688)
/forcehotpatch can be used to perform the hotpatch regardless.
2019-08-12 10:23:24 +02:00
TheJetOU
af93684d5e Fix Chat#collapseLineBreaksHTML 2019-08-11 11:03:35 -05:00
whales
10266ffe92 Typescript chat (#5620) 2019-08-10 15:30:34 -07:00