Commit Graph

129 Commits

Author SHA1 Message Date
Kris Johnson
82b20aaf8e
Use /msgroom in more places (#8042) 2021-02-16 20:10:05 -08:00
Mia
a6520350d3
Implement /msgroom (#8036) 2021-02-15 02:54:35 -08:00
Guangcong Luo
bce402d021 Fix context.parse() returning a string 2021-02-15 01:51:41 -08:00
Annika
6398bb67ee Remove /unbanall
Approved: https://discord.com/channels/534298043176976395/565617827298541572/783311845279662120
2021-02-08 20:24:05 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
Guangcong Luo
da30a71706 Revert "Remove User#inRooms and User#games (#7815)"
This reverts commit 5c9c84c415.

This also reverts commit 1fc92ef977.
2021-01-30 15:55:55 -05:00
Mia
8f4b07b163 Chat: Fix logging of slow commands in PM 2021-01-30 13:55:11 -06:00
Mia
e411890a47 Fix PM duplication 2021-01-30 13:41:47 -06:00
Guangcong Luo
f4abf52f61 Fix QueryProcessManager type signatures 2021-01-30 11:35:35 -08:00
Mia
8cf667a78d
Chat: Properly log slow async commands used in PM (#7966) 2021-01-30 09:41:40 -08:00
Distrib
4b404f5765
Improve /offertiehelp (#7952) 2021-01-28 10:43:06 -08:00
Mia
5c9c84c415
Remove User#inRooms and User#games (#7815) 2021-01-28 10:41:35 -08:00
Guangcong Luo
013851359c Support using avatars from username history
Now you can use `/avatar` for any private avatar you have access to
from your username history, without needing to change name every time.
2020-12-09 23:18:17 +00:00
Kris Johnson
fba68d5be6
Reformat old instances of CommandContext/Room#tr (#7744) 2020-12-01 06:31:55 -08:00
Mia
60bda2795f
CommandContext: Move parseCommand into Chat (#7661) 2020-11-11 19:59:38 -08:00
Guangcong Luo
1e39e19f00 Refactor chat to use Utils.splitFirst 2020-11-08 18:31:38 +00:00
Guangcong Luo
fbdda144eb
Support Config.noguestsecurity (#7625)
This Config option, intended purely for development test servers,
allows users to log in without a signed token, by using
`/trn [USERNAME]`. This allows logins without a login server.

The rest of the server has been changed to make sure unregistered
users never have any powers they shouldn't have.
2020-11-05 04:55:05 -08:00
Mia
56501355d7
Support ignoring room invites (#7180) 2020-11-03 10:15:17 -08:00
Marty-D
89050aaefb
Add missing Trainer avatars 2020-10-29 15:22:42 -04:00
Annika
a273e53e08
Make /clearstatus log to Staff room (#7557)
`/forcerename` and other global punishments do this
2020-10-27 19:24:09 -07:00
Guangcong Luo
9d87616176
Add more style linting rules (#7537)
* Lint arrow-body-style

* Lint prefer-object-spread

Object spread is faster _and_ more readable.

This also fixes a few unnecessary object clones.

* Enable no-parameter-properties

This isn't currently used, but this makes clear that it shouldn't be.

* Refactor more Promises to async/await

* Remove unnecessary code from getDataMoveHTML etc

* Lint prefer-string-starts-ends-with

* Stop using no-undef

According to the typescript-eslint FAQ, this is redundant with
TypeScript, and they're not wrong. This will save us from needing to
specify globals in two different places which will be nice.
2020-10-19 02:42:28 -07:00
Distrib
b433197e6a
Remove the broadcast cooldown for !showteam (#7486) 2020-10-09 13:25:21 -07:00
Annika
a3b83ba50b
Translations: Convert JSON to TypeScript (#7493) 2020-10-09 12:03:44 -07:00
Mia
fb23fc8733
/showteam: Properly handle nick/form names (#7489) 2020-10-08 13:31:29 -07:00
Annika
2660741e9a
Fix /help for room promotion commands (#7478) 2020-10-06 15:18:55 -07:00
Mia
aba5dd1119
/showteam: Support nicknames (#7464) 2020-10-03 08:25:14 -07:00
Annika
6e2a336975 Don't duplicate attributions in modlog entries 2020-09-28 15:26:30 -07:00
Guangcong Luo
46c470671a
Unify /guess (#7387) 2020-09-19 01:24:52 -07:00
Annika
38d62612f4
Move checkChat() in /invite (#7374) 2020-09-15 23:31:03 -07:00
Leonard Craft III
302d6ff6fb
Add hidestats arg to showteam and improve output (#7357) 2020-09-14 16:33:34 -07:00
Annika
52c5df12d5
Fix crash in /invite (#7364) 2020-09-14 16:28:22 -07:00
Annika
8542aa91a1
Re-add /cs as an alias for /clearstatus
I accidentally removed this in https://github.com/smogon/pokemon-showdown/commit/0a26579af.
2020-09-11 10:51:09 -07:00
Guangcong Luo
9b705936b0 Very ugly workaround for /me checkChat bug
There are too many conflicts to revert, so this will have to do for now.
2020-09-06 22:35:28 -04:00
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
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
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
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
Mia
fa7a0025e5
/showteam: Fix bugs (#7206) 2020-08-12 16:12:45 -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
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
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
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
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
Annika
fc764aa8e2
Support requiring high-rated users to register (#7073) 2020-07-29 00:16:02 -07:00
Mia
5ca45205db
Add a throttle for pending challenges (#7045) 2020-07-24 12:04:29 -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
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
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
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
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
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
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
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
0629a915a0 Support multiline /eval and /evalbattle 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
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
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
Leonard Craft III
f7c46b7f33
Allow leaders+ to exportinputlog directly (#6668) 2020-05-08 23:46:25 -07: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
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
Marty-D
8a29a46f25
Add more trainer avatars
made by Gnomowladny
2020-04-09 15:22:49 -04: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
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