Commit Graph

658 Commits

Author SHA1 Message Date
Annika
0a26579afa
Make core commands translatable (#7279) 2020-09-06 17:49:53 -07:00
Mia
44fc0123ad
Chat: Refactor CommandContext and PageContext to use ErrorMessage more (#7234) 2020-09-06 00:15:16 -07:00
Annika
df04c24a91
Weekban: Fix error message and add /wb alias (#7319) 2020-09-05 20:59:27 -07:00
Annika
13d1a4fa6d
Allow users to see their own hidden games in /whois (#7315) 2020-09-05 13:57:54 -07:00
Mia
7222b7280b
Support week roombans (#7311) 2020-09-05 08:13:21 -07:00
Guangcong Luo
acb851f857 Add a new command: /yearlockip
/yearlockip works like /lockip, but lasts for a year. It's intended to
be used to punish users who troll over a long term, but from a static
IP.

I've also separated strings out in a way that should make them slightly
easier to translate in the future.
2020-09-04 21:16:25 -07:00
Kirk Scheibelhut
afdbcd355e Update credits 2020-09-03 13:29:41 -07:00
Guangcong Luo
1217457b06 Fix /updateserver
This adds a bunch of minor fixes to /updateserver. The big one is that
we no longer stash untracked files, which should fix the problem where
it sometimes takes forever to update.

However, it seems like conflicting untracked files sometimes corrupts
the Git system?

    zarel@cytosine ~/W/psserver (master)> git rebase FETCH_HEAD
    Created autostash: abc06bdca
    First, rewinding head to replay your work on top of it...
    error: The following untracked working tree files would be overwritten by checkout:
        server/chat-plugins/help.ts
    Please move or remove them before you switch branches.
    Aborting
    fatal: Could not detach HEAD

    zarel@cytosine ~/W/psserver (master|AM/REBASE)> git rebase --abort
    error: could not read '.git/rebase-apply/head-name': No such file or directory

I couldn't reliably reproduce this, unfortunately, but I've switched to
`git rebase --no-autostash FETCH_HEAD` to be safe. File conflicts
are really rare in general, so I don't think that needs to be a
blocker.
2020-09-02 20:14:07 -07:00
Annika
94a6f14e48
Remove trusted user check in /hidetext (#7282) 2020-09-02 09:51:05 -07:00
TheMezStrikes
94b3e6f96f
Update CAP samples link to gen 8 (#7288) 2020-09-01 02:26:30 +04:00
Annika
c9fa3fc389
Refactor User#prevNames and User#ips to arrays (#7267) 2020-08-29 10:27:03 -07:00
Annika
dec6599f77
Fix /unlockip (#7276) 2020-08-28 19:43:58 -07:00
Annika
bece58ee93
Fixes for /unrangelock (#7266) 2020-08-26 22:48:00 -07:00
Annika
00a12e0355
Fix /unlockip's interaction with namelocks (#7252) 2020-08-26 08:19:24 -07:00
Kirk Scheibelhut
b20155878b
/hiderank should default to hiding as reg (#7249) 2020-08-23 04:25:40 -07:00
Guangcong Luo
ba4998350a Fix more bugs in /hiderank 2020-08-22 16:03:10 -07:00
Guangcong Luo
e14485656f Implement a basic /hiderank
This doesn't really have any nice-to-have automatic restoration
features but it should be all the important parts.

`user.group` no longer exists, and has been replaced with
`user.tempGroup`, which now applies both to temporary promotions of
unregistered users, as well as temporary hidden ranks of auth.
2020-08-22 07:20:26 -07:00
Guangcong Luo
2878793964 Revert accidental merge of /hiderank code
`/hiderank` code was accidentally merged into #7078

This fully backs out its code.
2020-08-22 06:57:24 -07:00
Annika
3ef50d8feb
Move forced public prefix logic to RoomBattle (#7244) 2020-08-22 05:29:51 -07:00
Annika
2b8268aabe
Make /updateserver private exit if no updates (#7242) 2020-08-21 15:38:50 -07:00
Mia
2561764bdc
Make /requestshow approvals staffintro look nicer (#7233) 2020-08-20 21:35:05 -07:00
Annika
a3c579c3c4
Fix crash in /updateserver private (#7236) 2020-08-20 21:29:57 -07:00
Spandan Punwatkar
7f0450673d
Add support for inverse in /weak (#7198) 2020-08-19 13:04:28 -07:00
Annika
8de5027703
Fix HTML tag in /faq (#7230) 2020-08-19 00:46:03 -07:00
Annika
44d369ca8a
Allow users to set their own language and translate helptickets (#7220) 2020-08-19 00:21:51 -07:00
Annika
fe2f77c5fe
Improvements to the /dnd command (#7196) 2020-08-18 16:56:51 -07:00
Annika
58c5a43e8d
Only allow the player who set modjoin to change it (#7216) 2020-08-18 12:54:22 -07:00
Guangcong Luo
0ca4ed2839 Improve private command support
Private commands can now use `this.privatelyCan` instead of `this.can`
to automatically display "command not found" in the command
(and in Help) for permission failure. They can also use
`this.commandDoesNotExist` to explicitly invoke the error message.

I'm not merging #7141 because I wrote basically all of the code
in this commit, and future blames should go to me if something here
is wrong.

Closes #7141

    Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com>
2020-08-16 13:21:07 -07:00
Annika
3197a53b53
Make the !faq command translatable (#7149) 2020-08-16 11:26:29 -07:00
Annika
49e9d8adda
Display G-Max moves properly in /details (#7117) 2020-08-15 17:57:27 -07:00
Annika
4cbf905ec8
Modlog: Fix exact searches and improve hotpatching (#7211) 2020-08-15 14:10:46 -07:00
Kris Johnson
7fc3cd516e
Add /nomarkshared (#7201) 2020-08-12 16:21:00 -07:00
Mia
fa7a0025e5
/showteam: Fix bugs (#7206) 2020-08-12 16:12:45 -07:00
Kris Johnson
8ba03fa10b
Fix crash with /dt (#7199) 2020-08-12 08:34:04 -07:00
Annika
2b809f99e4
Support updating private code in /updateserver (#7183) 2020-08-09 20:24:32 -07:00
Annika
814567c6e6
Roomsettings: Fix bug with single-command permissions (#7181)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-08-09 12:08:18 -07:00
Guangcong Luo
a315c93836 Switch to using import type
We were previously using `type Foo = import('bar').Foo` which works
actually equally well, because sucrase didn't support `import type`,
but now it does!
2020-08-09 08:07:00 -05:00
Mia
7faf35f2a4
Support opting in/out of blocking pms/chals with /busy (#7179) 2020-08-08 00:28:30 -07:00
Annika
1fa74d9868
Fix Auth#isAuthLevel (#7174)
Also prevents setting mod(chat|join) below regular user.
2020-08-07 11:05:18 -07:00
Annika
d25fa3c16d
Fix bug in /permissions (#7168) 2020-08-06 19:13:11 -07:00
Annika
f563252418
Modlog: Fix bugs and support hotpatching (#7163) 2020-08-06 22:05:13 -04:00
Mia
83e094bd37
Redesign /permissions help (#7146) 2020-08-06 10:06:02 -07:00
Lusamine
0f56db1853
Remove extra parentheses from 2 other privateModAction (#7162) 2020-08-06 10:04:36 -07:00
Guangcong Luo
873efe91ce Refactor extractRoom to requireRoom
New in PageContext as of 9b3a986ef4ef7:

`extractRoom` no longer shows an error message if the room isn't found.
Instead, `requireRoom` does that.
2020-08-06 00:54:02 -07:00
Mia
fd0f83ff8d
Add a command to show the user's team in battles (#7068) 2020-08-06 00:36:43 -07:00
Annika
8287cbc7fb
Remove User#authAtLeast and add more sysop bypasses (#7046) 2020-08-06 00:12:30 -07:00
Mia
647d5af76f
Add a filter for auto-answering questions in the Help room (#7100) 2020-08-05 23:44:46 -07:00
Annika
3572df1a0c
Fix demoting locked users (#7151) 2020-08-05 20:21:57 -07:00
Annika
04961fcbb8
Add short alias for /sharedbattles (#7150)
This was requested in Staff room a few days back but I forgot about it until now.
2020-08-05 04:32:55 -07:00
Mia
47d00bf912
Support per-command permissions for sub-commands (#7142) 2020-08-04 03:01:17 -07:00
Annika
2171032134
Room Settings: Don't display ' ' as a modchat option (#7129) 2020-08-02 17:02:51 -07:00
Volco
26e2a1c4d4
Fix renaming groupchats and groupchat creation (#7123) 2020-08-02 16:21:49 -07:00
Mia
71099df544
Fix /renamegroupchat's permission checking (#7101) 2020-08-01 18:15:34 -07:00
Spandan Punwatkar
fdea3aca28
Add /battlerules (#7029) 2020-07-31 18:06:19 -07:00
Quinton Lee
a8b3da922a
Allow bots to use !checkchallenges again (#7098) 2020-07-31 14:44:57 -07:00
Guangcong Luo
b4de66c8b9 Remove mistakenly-added /hiderank command
It was accidentally included in #7078 but is actually part of #7058
and crashes without the other changes.
2020-07-30 17:35:32 -04:00
Annika
05a9f9a1e5
Minor code quality improvements based on LGTM (#7092) 2020-07-30 14:24:37 -07:00
Annika
a1ce0cdce1
Moderation: Add /clearaltstext (#7086) 2020-07-30 00:35:30 -07:00
Annika
24c4f2ca55
Moderation: Support private reasons in /warn (#7050) 2020-07-30 00:00:47 -07:00
Annika
d8e7fb4692
Add short alias for /hidebattlesfromtrainercard (#7085)
This was requested and makes sense to me, since it's quite a long command to type out each time.
2020-07-29 23:59:31 -07:00
Annika
cd85cd7a9d
Hosts & IPTools: Refactor to remove hardcoded ranges (#7078) 2020-07-29 23:04:50 -07:00
Kris Johnson
70edfaa64c
Add support for more OMs (#7084) 2020-07-30 05:22:21 +04:00
Guangcong Luo
fe2eb27860
Refactor ip and modchat permissions (#7076)
- `ip` and `ipself` are now separate permissions. This means that `ip`
  is now a generalized permission for viewing IPs (no more need to use
  `globalban`, since `ipself` now controls the ability to see your own
  IP address)

- `alts` and `altsself` are now also separate (all users used to be
  able to `altsself`).

- `modchat`, `modchatall`, and `manageroom` are now just one `modchat`
  permission whose jurisdiction controls how high you can set modchat.
2020-07-29 00:38:52 -07:00
Guangcong Luo
add3a5d9f0 Fix bug when hidetexting own text 2020-07-29 00:37:18 -07:00
Mia
94fff9d496
Support customizing permissions per-room (#6883) 2020-07-29 00:22:03 -07:00
Mia
7216c493bb
Support renaming groupchats (#6965) 2020-07-29 00:21:24 -07:00
Annika
2da0317a71
Implement a /cleartext command (#7065) 2020-07-29 00:16:30 -07:00
Annika
fc764aa8e2
Support requiring high-rated users to register (#7073) 2020-07-29 00:16:02 -07:00
Mia
b0103c029d
/hidetext: Don't highlight the user (#7071) 2020-07-27 16:19:48 -07:00
Annika
c16750741a
Fix hotpatching IPTools and multiline patterns for Hosts (#7069) 2020-07-27 01:51:28 -07:00
Annika
e0c18e8e0b
Refactor IPTools and add a host management chat plugin (#7061) 2020-07-26 12:41:27 -07:00
Peach
f2bfe2538c
Make sendhtmlpage perms more strict, refactor perm checks (#7044) 2020-07-25 23:31:28 -07:00
Guangcong Luo
b5591fdccf Fix crash in /sendhtmlpage 2020-07-25 19:09:41 -04:00
Guangcong Luo
c08a1a3199 Fix drivers not having mod powers in battles
Battles are now considered personal rooms, and so
`globalGroupInPersonalRoom` now applies to them properly.
2020-07-24 18:51:38 -07:00
HoeenHero
86043a504a
Add a command to enable hotpatching (#7056) 2020-07-24 17:42:06 -07:00
Guangcong Luo
2f805c93a2
Remove "Battle" prefix from data exports (#7039)
`BattlePokedex` is now `Pokedex`, `BattleItems` is now `Items`, etc.

I also renamed `Movedex` to `Moves` and `Statuses` to `Conditions`.

`TypeChart` isn't `Types` yet, because unlike the others, it's not
indexed by ID. That should probably be fixed one day.
2020-07-24 12:42:26 -07:00
Mia
5ca45205db
Add a throttle for pending challenges (#7045) 2020-07-24 12:04:29 -07:00
Guangcong Luo
fdd90c4225 Properly fix roomwhitelist promotion/demotion 2020-07-24 14:21:13 -04:00
Mia
63819e8d1c
Make /sendhtmlpage send to the last active connection (#7051) 2020-07-24 10:59:53 -07:00
Mia
126a740b2a
Fix chat-commands.js mention in /hotpatch's help (#7047) 2020-07-24 10:46:54 -07:00
Annika
7e7620d301
Send information about locked users in /cmd userdetails (#7041) 2020-07-24 10:12:39 -07:00
Annika
528045a03f
Support hiding battles from /cmd userdetails (#7040) 2020-07-23 21:30:30 -07:00
Guangcong Luo
a42cdf25ff Fix unwhitelisting users 2020-07-23 18:53:39 -04:00
Guangcong Luo
a1e748c121 Fix bug in /renameroom notifications
They would not have actually worked.
2020-07-23 14:20:58 -07:00
Kris Johnson
00b88b521d
Handle Gigantamaxing properly (#7001) 2020-07-23 13:27:42 -07:00
Guangcong Luo
b53faf1768 Fix /sendhtmlpage 2020-07-23 12:54:01 -07:00
Mia
964f4f8d06
Add a command for bots to send HTML pages (#6934) 2020-07-23 12:05:45 -07:00
Peach
e9611b7ce2
Remove unnecessary references to the global room (#7033) 2020-07-22 08:52:46 -07:00
Lusamine
3a2ca90040
Minor cleanup of global demotion messages (#7011) 2020-07-17 01:17:36 -07:00
Guangcong Luo
2e9328eada Support annotating chat commands
The nullable room refactor made it so there was no longer an easy way
to tell if a command could be used in PMs. This adds it back, as a
property on the handler function itself.

Now that we have properties on handler functions, I also added
`broadcastable` for whether or not the command is broadcastable.

It uses `Function#toString`, which is generally frowned-upon, but it's
well-specified and only happens during startup, so it shouldn't affect
performance after startup.

This also allows us not to need to repeat ourselves or give up
flexibility to have metadata about commands, which I think is worth the
tradeoff of reflection generally.
2020-07-13 00:55:23 -07:00
Guangcong Luo
52f0096c30 Refactor Auth.hasPermission
Half the permissions checks were previously in `user.can`, which is
unintuitive. It's now completely self-contained and should be pretty
readable, now, with `getEffectiveSymbol` and `hasJurisdiction` as
separate functions.
2020-07-13 00:55:23 -07:00
Annika
b590d3c907
Add /noreply command (#6953)
This command should never be used by users.

This is for scripting, like buttons, like:

    <button name="send" value="/nofeedback /ionext">

so they don't spam your PMs.
2020-07-10 22:01:15 -07:00
asgdf
2136c34e8e
Fix trustuser commands (#6988) 2020-07-09 23:30:47 -07:00
TheMezStrikes
a719c5f7e3
Trim !show image comment (#6987) 2020-07-09 16:08:51 -07:00
Guangcong Luo
faab60a618 Unify command logging code
Global punishments like /lock will notify Staff, and admin commands
like /updateserver will log to Staff, but this has been done ad-hoc
in the past.

To handle these cases, this commit introduces new chat-context
functions:

- `this.addGlobalModAction`,
- `this.privateGlobalModAction`
- `this.stafflog`

Other updates:

- the issue where Staff notifications didn't show up until someone talks
  has been fixed
- `privateModAction`s in Staff will now be visible in the scrollback
  log
- a bunch of commands that should notify Staff but didn't now do
- some typos in modlogs have been fixed
2020-07-07 18:51:29 -07:00
Kirk Scheibelhut
eea2196280
Server side changes to support persistent user settings and privacy changes (#6947)
NOTE: This is changes the semantics of `hidenext`/`ionext` from
applying to the next created *battle* to applying to the next
created *search*/*challenge*.
2020-07-06 21:18:38 -07:00
Guangcong Luo
9879d29cb8 /makechatroom no longer defaults to public 2020-07-06 17:12:01 -07:00
Kris Johnson
1a9d0611a6
Add quality-of-life fixes for Pet Mods (#6968) 2020-07-06 16:44:09 -07:00
whales
6d3cf8a972 Remove unnecessary room requirements from some commands 2020-07-07 00:54:50 +09:30
Mia
4997a47314
Commands: Allow the room parameter to be null (#6948)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-07-05 14:25:09 -07:00
Guangcong Luo
d7ba455e2b Update permissions
Permissions have gotten out-of-date, so this commit syncs them.
Default permissions are now matched with Main, in particular including
the new & rank as admin (removing the old Leader rank and ~ symbol).

Relevant changes:
- Admin (~) and Leader (&) have been merged into Admin (&)
- The 'ban' permission was split into 'globalban' and 'ban'
- The 'broadcast' permission was renamed 'show' (going forward,
  "broadcast" should only refer to the big red/blue/green
  announcement bars.)
- Bots no longer have global moderation abilities, making it
  easier to give untrustworthy bots the "bot" rank.
2020-07-03 17:32:49 -04:00
Guangcong Luo
26615490f7 Merge BasicChatRoom and BasicRoom
They were only ever kept separate because of GlobalRoom. It might be
useful to support rooms that aren't ChatRooms, but we've been chucking
properties into either BasicChatRoom or BasicRoom essentially at
random, so I think it makes sense to wait until we actually have a
use-case for a non-Chat room before carefully deciding which properties
belong where.
2020-07-02 18:54:02 -07:00
Guangcong Luo
46c9afa2f3
"Remove" the global room (#6885)
I couldn't completely remove the global room in one commit, but this
solves basically every problem with it by making it no longer a `Room`.

In particular, this means:

- It's no longer of type `Room`
- It's no longer in the `Rooms.rooms` table
- Its class name is now `GlobalRoomState` rather than `GlobalRoom`
- It no longer tracks its own user list (online user count is now
  provided by `Users.onlineCount`)
- It's no longer a socket channel (there's new syntax for "send this
  message to every user")
2020-07-02 11:31:34 -07:00
Guangcong Luo
d20a4a9918 Remove unnecessary update in /requestshow 2020-07-01 16:37:36 -07:00
Mia
5d72fe2f74
Fix /viewapprovals (#6935) 2020-06-30 23:17:24 -07:00
Mia
75f9937aad
Info: Support viewing current media requests and hiding media (#6907) 2020-06-30 15:59:52 -07:00
Austin Couturier
25c185c010
Fix /tour forcepublic to prevent /hiddenroom (#6932) 2020-06-30 12:09:30 -07:00
Austin Couturier
f08bc21f26
Add an option to force public replays for room tournaments (#6927) 2020-06-29 19:21:21 -07:00
TheMezStrikes
a3c0d69b3c
Add /st as /servertime alias (#6911) 2020-06-24 05:31:07 -07:00
Guangcong Luo
6af875af8b Improve RoomPermission/GlobalPermission checks
Global permissions can no longer be used as room permissions. Instead,
the two are entirely separate lists, with only a few permissions in
both lists.
2020-06-21 03:53:06 -07:00
Guangcong Luo
ee6e43b552 Strongly type RoomPermission and GlobalPermission
`user-groups.ts` now tracks the list of possible values for
`RoomPermission` and `GlobalPermission` in a const.
2020-06-21 01:43:27 -07:00
Nixola
00d0647dec
Prevent empty string from being added to banwords (#6887)
Filter out empty strings from the `banword add` and `banword delete`
arguments. Added a check in `banword add` for an empty array of
arguments.
2020-06-20 20:50:53 -07:00
urkerab
273eb928cf
Show status immunities in /weak output (#6889) 2020-06-20 20:49:50 -07:00
Peach
6c517b5562
Roomsettings: Fix language, modjoin, button formatting (#6879) 2020-06-19 17:36:37 -07:00
Guangcong Luo
20336fdfa0 Refactor /requestshow 2020-06-18 23:47:39 -07:00
Mia
501f773204
Improve /requestshow (#6868) 2020-06-18 23:43:41 -07:00
Mia
d2b255b934
/eval: Log in dev room and broadcast (#6871)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-18 23:28:15 -07:00
Mia
f8b95ce9a0
Rooms: Save creation time for all rooms (#6845) 2020-06-18 19:45:30 -07:00
Guangcong Luo
af7ca0e73c Clarify "Whitelist" in /roomauth as staff-only
I definitely heard some staff members be concerned that it shouldn't
be shown to regular users.
2020-06-18 00:01:57 -04:00
Mia
233f2aef9a
Fix setting modchat in battles (#6860) 2020-06-17 20:46:59 -07:00
Guangcong Luo
cc22bae74f Fix crash in /editbattle 2020-06-17 18:12:34 -07:00
Guangcong Luo
839d86a2ab Refactor /makegroupchat a little
None of these are likely to fix the lag spike, but I couldn't find
anything that stuck out.
2020-06-17 21:11:52 -04:00
Guangcong Luo
ba53a2831c Fix bugs in /show
- Chat.getImageDimensions and Chat.fitImage now throw if passed things
  that aren't image URLs.
- Fix help message if you use /show by itself
- Link to full aize image if image is shrunk
2020-06-17 21:11:52 -04:00
Charlie Kobayashi
e51c4ce290
Fix minor issues with /show commands (#6849) 2020-06-16 20:12:34 -07:00
Guangcong Luo
32b5b43244 Fix unexcaped URI in /requestshow 2020-06-16 18:44:23 -07:00
Mia
6c97866f83
Add commands to show media in chat (#6745) 2020-06-16 14:40:10 -07:00
Kris Johnson
3228f91fbc
Fix uncommon evolution methods (#6830) 2020-06-13 12:46:21 -07:00
Guangcong Luo
8748427dce Fix TS error in PM
It's surprising to me that this happened after e0f97dcf6b, which
doesn't touch this line.
2020-06-13 10:54:22 -07:00
Guangcong Luo
e0f97dcf6b Replace Chat.uncache* with Utils.clearRequireCache
This replaces the old approach with a new "clear everything except a
whitelist" approach, which should overall involve much less code and
lead to fewer bugs of the "the path changed for a module and I forgot
to update the uncache paths" variety.

I considered a lot of other approaches, but they seem to have more
flaws without any advantages in exchange for them. (We moved away
from `uncacheTree` because it only tracks the first require: there's
no way to get a full list of dependents for a module, only its first
dependent.)
2020-06-12 22:02:32 -07:00
Annika
428205fe93
Don't default to showing 'trusted' in /userauth (#6828) 2020-06-11 16:01:55 -07:00
Austin Couturier
c9b2b9dbf2
Change |pm|~ to |pm|& (#6827) 2020-06-10 21:53:36 -07:00
Guangcong Luo
0629a915a0 Support multiline /eval and /evalbattle 2020-06-10 11:23:20 -04:00
Guangcong Luo
140f4ad936 Support /forceroompromote
Previously, forcepromotes were done with a !!! sigil, which was
kind of silly. They now use a command starting with "force", as
is standard.
2020-06-10 11:23:20 -04:00
Guangcong Luo
0da724cba7 Correct /auth sorting direction
This also refactors /auth and /roomauth to both be in
moderation.ts (as good a place as any), and to use Utils.sortBy.
2020-06-10 11:23:20 -04:00
Mia
6839a1f4db
Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Guangcong Luo
8c4d55b184 Fix bugs in Settings refactor 2020-06-09 15:40:54 -04:00
Guangcong Luo
c444036f85 Support whitelisting users
(Whitelist is being implemented as a hardcoded custom group.)
2020-06-09 08:22:44 -07:00
Mia
15fed24b40
Refactor auth and room.settings (#6777)
This implements two big changes:

- All settings shared between `room.chatRoomData` and `room` have been
  merged into `room.settings` (so, for instance, `room.slowchat` is now
  only `room.settings.slowchat`).

  This makes it so we never have to worry about them getting "out of
  sync".

  - Checking to see if a room is persistent is now `if (room.persist)`
    instead of `if (room.chatRoomData)`

  - `Rooms.global.writeChatRoomData()` is now rarely called directly;
    there's a new `room.saveSettings()` which will handle it for you.

  - All properties of `room.settings` are now optional (except
    `title`).

- There's a new file `user-groups.ts` which handles authority.

  - `room.auth` and `Users.globalAuth` are now
    `Auth extends Map<ID, GroupSymbol>` objects.

  - `room.auth` is now always defined, removing the need for
    `room.auth?.[userid]` workarounds.

  - A lot of code relating to usergroups and permission checks have
    been refactored.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-09 08:22:25 -07:00
DeltaCoderr
70ab234f1d
Add Room Owner rank in Help Commands (#6821) 2020-06-09 07:48:46 -07:00
Annika
406eaed520
Add /dt(gen) as an alias to use /details for a gen (#6806) 2020-06-08 12:39:20 -07:00
Annika
f4863a9444
Update references to Global Administrators post-flattening (#6815)
Co-authored-by: Charlie Kobayashi <sparkychildcharlie@gmail.com>
2020-06-08 09:41:03 -07:00
urkerab
eb84554a12
Remove last vestige of Pokebank (#6812) 2020-06-07 06:46:40 -07:00
Guangcong Luo
08420c7feb Reassign hotpatch permissions
Currently, 'hotpatch' and 'lockdown' are admin permissions, and
'console' is a console admin permission. In preparation for the
admin/leader unification, I'm removing the hotpatch permission:

- /memoryusage, /loadbanlist, /adddatacenters, /refreshpage,
  /loadbanlist have been moved from 'hotpatch' to 'lockdown'. This
	doesn't change anything, I'm just unifying the permission name.

- /updateserver has been moved from 'hotpatch' to 'console'.
  /updateserver in combination with either hotpatch or lockdown can be
	used for arbitrary code execution, and is approximately as dangerous
	as any other console command.

- /hotpatch, /savelearnsets have been moved from 'hotpatch' to
  'console'. They're reasonably harmless, but they don't do anything
	without console access, so a non-console admin using them is nearly
	definitely some sort of mistake.

`user.hasConsoleAccess` now also has a CommandContext function
`this.canUseConsole` to handle its error message.
2020-06-06 07:44:31 -07:00
Annika
cc6334c8ce
Support specifying a reason for /hidetext (#6804) 2020-06-05 15:42:32 -07:00
Annika
14e75c7be6
Support minimizing roomintro/staffintro source code (#6754) 2020-06-04 11:04:54 -07:00
Guangcong Luo
58b958c6fe Improve TS 3.9 property checks
These were previously fixed in 6e2b475dac, but I prefer an approach
that makes sure e.g. `pipeTo = undefined` doesn't break this check.
2020-06-04 10:23:04 -07:00
DeltaCoderr
0c88586a7d
Make /pi command broadcastable (#6796) 2020-06-03 08:51:03 -07:00
Kris Johnson
a7948c7c9c
Typescript config/ (#6760) 2020-05-29 19:34:43 -07:00
Annika
54ee5e4444
Add more move target types to /details (#6756) 2020-05-29 16:59:06 -07:00
Alexander B
b546337b18
Fix and enhance /editbattle (#6758) 2020-05-29 05:59:13 -07:00
fart
73f58e0855
Increase autojoin limit to 15 (#6728)
Per https://www.smogon.com/forums/threads/increase-chatroom-autojoin-limit.3657450
2020-05-24 18:43:53 -07:00
PartMan
c3def9cdff
Fix Effectiveness showing undefined (#6733)
(change .species => .name)
2020-05-23 12:18:40 -07:00
Guangcong Luo
7c979807fa Rename /rename to /renameroom
I didn't notice that this command was named `/rename` and not
`/renameroom`. The problem was that `/rename` looks like it renames
users (like a non-forced version of `/forcerename`), and all other
room commands with this ambiguity do have `room` in them, like
`/deleteroom`, for this exact reason.
2020-05-22 13:31:57 -07:00
Volco
0dee619326
Fix the rename command to log the new room & require a target (#6710) 2020-05-18 09:21:14 -07:00
AnnikaCodes
e7d72ba4e8
Add more information to /faq autoconfirmed (#6696) 2020-05-17 07:35:27 -07:00
Guangcong Luo
78a29656ac Fix /data defaulting to numbers instead of tiers
Fixes #6700
2020-05-16 10:58:31 -04:00
Guangcong Luo
1d6d8f73da Refactor HTML validator
Mostly, extraneous `<` tags are now correctly detected, with a better tag tokenizer.
I also removed the separate passes for <img> and <button> validation.

Fixes #6685

Thanks PartMan for contributing some ideas.
2020-05-16 10:51:45 -04:00
Konrad Borowski
c687b3b0ed
Replace attributed uhtml on change (#6693)
Not doing so wastes a lot of bandwidth.

This fixes https://www.smogon.com/forums/threads/dont-send-all-uhtml-messages.3664370/

`|uhtmlchange|` is no longer automatically parsed; please use
`room.uhtmlchange(` instead.
2020-05-16 07:16:42 -07:00
Kris Johnson
59f2a59fbc
Fix /roomtierdisplay permissions (#6699) 2020-05-16 00:03:18 -07:00
Kris Johnson
2a642afac9
Support changing /data's tier in /roomsettings (#6675) 2020-05-15 18:55:09 -07:00
HoeenHero
a1916a2919 Fix /statcalc 2020-05-14 17:11:17 -04:00
AnnikaCodes
ca45d16cd2
Update links in /intro for Gen 8 (#6678) 2020-05-14 20:00:55 +04:00
Kirk Scheibelhut
6e2b475dac Change property checks to TypeScript 3.9 2020-05-12 20:11:56 -07:00
Mia
7bd0ce8dc7
Require forcing for bans and blacklists on trusted users (#6680) 2020-05-12 02:02:53 -07:00
Kris Johnson
d20f1fbb64
Typescript info (#6670) 2020-05-11 03:08:33 -07:00
Leonard Craft III
f7c46b7f33
Allow leaders+ to exportinputlog directly (#6668) 2020-05-08 23:46:25 -07:00
Kirk Scheibelhut
2af7040270
Group zMove and maxMove attributes (#6652)
This mostly serves to provide cleaner and more consistent field
naming. maxMove currently doesn't have boosts or effects to group
together but who knows what will be thrown at us via DLC, and being
symmetrical with zMoves is a nice.
2020-05-04 20:21:27 -07:00
Leonard Craft III
5dce0ef1a1
Update /bugs with new bug reports thread (#6653) 2020-05-04 19:35:15 -07:00
Nol
7ae54deaf7
Add bl as an alias for blacklist (#6646) 2020-05-02 18:05:08 -07:00
Waleed Hassan
a29c62e71c
Fix hotpatching chat (#6643) 2020-05-02 12:32:16 -07:00
Kris Johnson
979be98574
Refactor inheritsFrom to changesFrom (#6611) 2020-04-26 14:44:25 -07:00
Austin Couturier
2ea1e00ef2
Mention TypeScript in /git (#6617) 2020-04-26 10:53:16 -07:00
AnnikaCodes
65fe886111
Don't broadcast errors in !formathelp (#6616) 2020-04-25 14:05:15 -07:00
Guangcong Luo
1dada44a2a Support server/chat-plugins/private as symlink 2020-04-25 15:51:11 -04:00
Guangcong Luo
6a685df8c7 Fix crashes when hotpatching chat
(Also fix a mistaken thing-of-the-day refactor: I blame giving two
different variables the same name.)
2020-04-25 11:11:24 -04:00
Astrid Halberkamp
008ff20dd8 Use better chatfilter handling in /makegroupchat 2020-04-25 17:06:39 +02:00
Guangcong Luo
31a81a91a2 Fix @type in .ts files
Some JSDoc type assertions failed to get converted during various .ts
refactors. This commit takes care of them.
2020-04-24 14:19:08 -07:00
Guangcong Luo
f6f4467265 Turn on prefer-const for .js files
Not having prefer-const on the JS side makes JS -> TS refactors really
unreadable. This commit just auto-fixes it so we're using
`prefer-const` everywhere.
2020-04-23 11:37:47 -07:00
AnnikaCodes
2c08cde63a
Add G-Max Move to /details results (#6599) 2020-04-22 01:38:37 -07:00
Guangcong Luo
776ccf9796
Refactor Sockets to ProcessManager+TypeScript (#6584) 2020-04-17 04:05:45 -07:00
Guangcong Luo
c49343b7e2 Setting a room rank can no longer demote globals
Previously, if you gave e.g. roomvoice to a global moderator, that
would demote their room rank to voice. Now, they will remain a
moderator, with "voice" only appearing in `/roomauth` and `/auth`.

(Includes a refactor of Config.groups)
2020-04-17 03:32:11 -07:00
AnnikaCodes
e626299c39
Add /faq tournaments (#6500) 2020-04-12 23:05:26 -07:00
whales
cf910afaac Fix bug in roombanning 2020-04-10 13:41:03 +09:30
Marty-D
8a29a46f25
Add more trainer avatars
made by Gnomowladny
2020-04-09 15:22:49 -04:00
Guangcong Luo
806ce433da Fix zombie processes after hotpatching chat 2020-04-08 12:02:42 -07:00
Mia
3fc757e958
Typescript chat-commands/moderation, refactor Punishments (#6490) 2020-04-08 11:56:19 -07:00
Guangcong Luo
572342c8a0 Support listing gvoices with /auth + 2020-04-07 21:47:56 -04:00
Guangcong Luo
f8cac19340 Add more Ash avatars 2020-04-07 21:47:55 -04:00
Austin Couturier
d9db072fc8
info.js: Update the /randomscalc command (#6537)
also change the link for /calc as per pre
2020-04-07 17:26:29 -07:00
The Immortal
634658a5ba Refactor unreleased Pokemon
Pokemon that are not available in-game are now consolidated into `isNonstandard`. 'Past' indicates that the Pokemon no longer works in the current generation. 'Unobtainable' indicates that the Pokemon works but can only be obtained through hacking.
2020-04-06 20:53:03 +04:00
HoeenHero
4aa40b64f0 Fix typo in 7583841d42 2020-04-03 11:24:23 -04:00
HoeenHero
7583841d42 Fix issues with /processes and /data
/processes - Accidental conversion of basename -> basespecies reverted.
/data - Fixed providing a pokedex number as an argument.
2020-04-02 23:56:14 -04:00
fart
8fda9da4d0
Fix minor /hidetext bug (#6511)
If /hidetext is used with a linecount parameter on a trusted user, it currently says "USER, 4 is a trusted user, are you sure you want to hide their messages? Use /forcehidetext if you're sure." This change hides the additional linecount parameter from the message.
2020-04-01 09:15:06 -07:00
Kris Johnson
ed9f1eb5e2
Fix /weak not showing Pokemon names (#6498) 2020-03-28 02:49:02 -07:00
Kris Johnson
994fc60aed
Rename Template to Species (#6478) 2020-03-25 23:29:27 -07:00
asgdf
34162abb8b
Add /monthlock command (#6488) 2020-03-25 03:59:47 -07:00
Guangcong Luo
0afa0d49bc Fix /invite permissions
Now that roomauth bypasses modjoin, promoting anyone to roomvoice is
sufficient to give them access to any room.
2020-03-23 23:52:16 -07:00
Mia
1628258371
Typescript chat-commands/core (#6484)
Also fix TS line numbers in GitHub Actions
2020-03-23 23:50:35 -07:00
whales
9ad7b53bdb Don't fail silently in uhtml commands 2020-03-23 20:33:42 +10:30
fart
80cfacc2b0
Support /hidetext [line count] (#6471) 2020-03-22 15:53:40 -07:00
Peach
2bf71cd42d
Attribute addhtml and code commands (#6444) 2020-03-20 20:58:56 -07:00
Kris Johnson
3e26318758
Refactor learnsets.js (#6466) 2020-03-18 00:59:29 -07:00
Guangcong Luo
60cbd7d0d7 Implement /chatlog command 2020-03-14 00:04:16 -04:00
Peach
d9f2f8e745
Block hotpatches while updating/rebuilding (#6445) 2020-03-12 00:45:14 -04:00
Guangcong Luo
64ff1da81f Refactor more things to use inheritsFrom 2020-03-10 09:59:36 -07:00
Guangcong Luo
efa98a08b9 Improve linkRegex
We're now using regexfree for linkRegex as well as the indentation
rule.

https://zarel.github.io/regexfree/
2020-03-08 20:16:53 -07:00
Guangcong Luo
4616bf1090 Fix bug in /addhtmlbox 2020-03-07 16:31:52 -08:00
asgdf
cac033ab86
Improve handling of mobile IPs with permalocks (#6338) 2020-03-07 11:50:08 -08:00
Guangcong Luo
125fe31d06 Improve eslintrc
Fixed some more code style, allowing these rules to be enabled:

- `comma-dangle`
- `function-paren-newline`
- `member-delimiter-style`
- `no-eval`
- `no-fallthrough`
- `no-misused-promises`
- `no-unused-vars`
- `operator-linebreak`
2020-03-06 22:35:55 -08:00
Waleed Hassan
8aa4f053bb
Use optional chaining and linter improvements (#6422)
This is mostly just a follow up to #6342.

`prefer-optional-chaining` was turned on and fixed in every location it
complained in. The transformed function [0] looks expensive from a
glance but from skimming through the replaced sites it doesn't appear
to be ran in any important place, so it should be OK.

The linter improvements are:
- Increase linter performance
	- Make `full-lint` and `lint` write to different caches so we
	  avoid overwriting their caches since they're different configs
	- Change husky's hook to `npm run lint` so as to write to the
	  same cache
	- Remove `@typescript-eslint/eslint-plugin-tslint` which is
	  essentially a wrapper to TSLint because the rules aren't worth
	  running another linter
- Convert `.eslintrc.json` and `.eslintrc-syntax.json` to two spaces
  rather than four tabs to respect PS' `.editorconfig`
- Rename `fulllint` to `full-lint` to ease spelling it

[0] - https://pastie.io/mmtxpf.js (prettified)
2020-03-06 11:44:32 -08:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
whales
26fa367f75
Fix bugs with renaming rooms (#6392) 2020-02-24 23:54:10 -08:00
Ben Davies
1be30cf29a Commands: prevent /code from trimming leading horizontal whitespace 2020-02-24 01:45:17 -04:00
whales
1920ca8161 Fix lint error 2020-02-22 01:22:07 +10:30
whales
926970f765
Automatically upload replays when reporting (#6380) 2020-02-21 00:47:19 -08:00
Waleed Hassan
34e215c7a6
Support renaming rooms (#6295) 2020-02-21 00:47:07 -08:00
Mia
7d54352169
Add /shuffle command (#6372) 2020-02-18 16:45:32 -08:00
Kris Johnson
9aaab2c57b
Typescript Help Tickets and Modlog and fix warnings (#6352) 2020-02-12 21:48:03 -08:00
The Immortal
b91779476f Update /formathelp for OMs 2020-02-12 23:31:01 +04:00
Guangcong Luo
1051b9e4ba Sent a useful tip if someone sends /nick 2020-02-11 14:43:05 -08:00
whales
bf84c0bc5e Support /forcetrustuser for offline trusting (#6301) 2020-01-26 12:54:07 -08:00
Ben Davies
88ccff34ec Commands: filter guests from the userlist in /cmd roominfo's response 2020-01-20 05:45:26 -04:00
Waleed Hassan
02c862da31 Add a GroupSymbol type (#6285) 2020-01-14 14:07:11 -08:00
Kris Johnson
dde822edd3 Fix Flying Press crash in /coverage (#6275) 2020-01-11 07:31:14 +04:00
HoeenHero
584175c57c Update help information for modchat 2020-01-08 08:17:10 -05:00
asgdf
45b808b181 Fix /statcalc without pokemon argument (#6237) 2020-01-03 01:56:01 +04:00
Ocean-ey
7260db1b3d Update !code description (#6248)
!code no longer requires global voice to use in PM's.
2020-01-01 07:52:31 +04:00
whales
1f9bf5df6a Fix modchat error message 2019-12-29 10:29:09 +10:30
Ben Davies
e8c8e0d9bd Add CommandContext#shouldBroadcast and fix !code permission checks (#6198) 2019-12-28 16:26:50 +09:00
whales
456f987cb3 Give mods access to /host (#6200) 2019-12-23 02:49:23 +09:00
Ben Davies
8470325f35 Commands: Remove some restrictions on /code (#6182) 2019-12-20 00:45:49 +09:00
Kris Johnson
dd016c21ff Add support in /details for Pokemon that require special trading conditions (#6194) 2019-12-19 20:38:05 +09:00
whales
d7c03256aa Fix modchat modlog entry (#6196) 2019-12-19 20:34:30 +09:00
HoeenHero
d8d59dbbae Fix modchat modlog message 2019-12-18 18:11:39 -05:00
whales
8a2969eb18 Fix rebuilding on windows (#6191) 2019-12-17 05:29:24 +09:00
Kris Johnson
42321c5e68 Display Dynamax Power on moves in /details (#6189) 2019-12-16 15:36:28 +09:00
fart
0291eabce3 Include National Dex mons in veekun command (#6186)
Currently fails on Pokemon and moves not included in gen 8
2019-12-16 04:08:48 +09:00
420Blazeitt
59584aea54 Update /smogdex to gen 8 (#6169) 2019-12-11 03:08:15 +09:00
whales
496cbb70db Check permissions for offline warns 2019-12-09 13:49:52 +10:30
Kris Johnson
2854e71166 Fix various evolution methods (#6160) 2019-12-07 17:15:31 +04:00
whales
0b9d8dd109 Support declarative roomsettings syntax (#6119) 2019-12-06 23:16:55 +09:00
whales
06ba503227 Refactor modchat permission check (#6123) 2019-12-01 10:13:22 +13:00
whales
f7d5cefc7d Refactor tournament plugin loading (#6118) 2019-11-30 17:53:01 +13:00
whales
20c708b20a Typescript roomsettings (#6117) 2019-11-30 17:34:14 +13:00
PartMan
37e7189008 Don't display Z-Power for Max moves (#6111) 2019-11-30 10:16:42 +13:00
PartMan
7af93a4a79 Don't display Weight for GMax Pokemon (#6091) 2019-11-29 10:34:54 +13:00
Spandan Punwatkar
b6b66de896 Update Repo Links (#6102) 2019-11-28 12:47:38 +04:00
urkerab
09b66da216 Use Chat.html`` a bit more 2019-11-27 15:14:46 +01:00
Guangcong Luo
5364c63e23 Introduce item.itemUser
`item.itemUser` replaces `item.zMoveUser`, and is a new field
representing a list of possible users of an item, for items that are
restricted to specific species.

`item.zMoveUser` is a base forme for items that affect every forme, and
a forme name otherwise (forme name is currently only used for
`forcedForme` uses).

Arceus is a weird case. Both generic Z crystals and Plates, while
having unique effects on Arceus, also have effects on other Pokémon.
For this reason, Arceus isn't listed as an `itemUser` of either of
these item types - use-cases that want this should also check
`item.forcedForme`.

This is mostly intended to be useful to move-searching and custom
rules (like NatDex, which will only allow past-gen items associated
with removed species).
2019-11-25 15:26:36 +13:00
whales
544d331a65 Report normalized target for hotpatches (#6057) 2019-11-24 10:22:48 +13:00
PartMan
3249a10e03 Display user for GMax moves in /dt (#6059) 2019-11-24 10:22:07 +13:00
Kris Johnson
8370c488ce Fix the evolution method of new Pokemon (#5982) 2019-11-20 21:44:16 +13:00
Alexander B
347714116c Add "Past Gens Only" to gen 8 /dt (#5958) 2019-11-16 20:20:01 +13:00
Guangcong Luo
a01daed212 Fix /rebuild crash 2019-11-16 10:10:33 +13:00
peach
52a10f8291 Fix paths when hotpatching properly 2019-11-15 23:35:56 +10:30
peach
42aec533a6 Fix paths when hotpatching 2019-11-15 23:34:19 +10:30
Kris Johnson
46ad0bccd7 Add Gen 8 Pokemon 2019-11-15 22:01:36 +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