Skip to content

Commit

Permalink
upgrade: 4.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PartMan7 committed Nov 15, 2024
1 parent 865ac35 commit 09cdee6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## What's New

**v4.3.0**

- Adds `Room#pmHTML` and `Room#pageHTML`.
- Adds support for sending HTML to multiple users simultaneously via `Room#pageHTML` and `Room#privateHTML`.
- Updates documentation and JSDoc comments.

**v4.2.0**

- Adds handling for `/botmsg` PMs as regular PMs with the relevant command.
Expand Down
16 changes: 9 additions & 7 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ Message has the following methods:

- `reply (text: string): Promise<Message>` sends a message to the target and returns a Promise that is resolved with the sent Message, or is rejected with the message content. This is a shortcut for `Message#target#send`.
- `privateReply (text: string): true` sends a private response (private HTML message (formatted by `Tools#formatText`) in the room if possible, otherwise a direct message).
- `sendHTML (html: string, opts?: HTMLopts): boolean` is an alias for [Room#sendHTML](#room-structure) and [User#sendHTML](#user-structure).
- `replyHTML (html: string, opts?: HTMLopts): boolean` is an alias for [Room#privateHTML](#room-structure) and [User#sendHTML](#user-structure).
- `sendHTML (html: string, opts?: HTMLopts): boolean` is an alias for [Room#sendHTML](#room-structure) or [User#sendHTML](#user-structure).
- `replyHTML (html: string, opts?: HTMLopts): boolean` is an alias for [Room#privateHTML](#room-structure) or [User#sendHTML](#user-structure).

Note: A message can have `author` and `target` nullish if sent by the `&` account. Handle those accordingly!

Expand All @@ -86,9 +86,11 @@ Room has the following properties:
Room has the following methods:

- `send (text: string): Promise<Message>` sends a message to the Room and returns a Promise that is resolved with the sent [Message](#message-structure), or is rejected with the message content.
- `privateSend (user: string | User, text: string): boolean` sends a message in chat that is only visible to the specified user. Returns `false` if the client does not have permissions. Text is formatted using `Tools#formatText`.
- `sendHTML (html: string, opts?: HTMLopts): boolean` sends a UHTML box to the room with the specified (optional) options. For example: `Room.sendHTML('<b>This is an example.</b>', { rank: '+', change: true })`
- `privateHTML (user: string | User, html: string, opts?: HTMLopts): boolean` behaves similarly to sendHTML, the difference being that privateHTML only sends the HTML to the specified user.
- `privateSend (user: string | User, text: string): string | false` sends a message in chat that is only visible to the specified user. Returns `false` if the client does not have permissions. Text is formatted using `Tools#formatText`.
- `sendHTML (html: string, opts?: HTMLopts): string | false` sends a UHTML box to the room with the specified (optional) options. For example: `Room.sendHTML('<b>This is an example.</b>', { rank: '+', change: true })`
- `privateHTML (user: string | User | (string | User)[], html: string, opts?: HTMLopts): string | false` behaves similarly to sendHTML, the difference being that privateHTML only sends the HTML to the specified user(s).
- `pageHTML (user: string | User | (string | User)[], html: string, opts?: HTMLopts): string | false` sends HTML pages to the given user(s).
- `pmHTML (user: string | User, html: string, opts?: HTMLopts): string | false` pms HTML to the given user.
- `waitFor (condition: (message: Message): boolean, time: number): Promise<Message>` waits for a message in the Room. This is resolved when the Client receives a message from the Room for which `condition` returns true, and is rejected if (time) milliseconds pass without being resolved. By default, time corresponds to 1 minute - you can set it to 0 to disable the time limit.
- `update (): void` refetches the entire room metadata (as well as all userdetails of users in the room).

Expand Down Expand Up @@ -116,8 +118,8 @@ User has the following properties:
User has the following methods:

- `send (text: string): Promise<Message>` sends a message to the User and returns a Promise that is resolved with the sent [Message](#message-structure), or is rejected with the message content.
- `sendHTML (html: string, opts?: HTMLopts): boolean` sends a UHTML box to the user with the specified (optional) options. For example: `User.sendHTML('<b>This is an example.</b>', { change: true })`
- `pageHTML (html: string, opts?: HTMLopts): boolean` sends a UHTML box to the user with the specified (optional) options (reusing a name will overwrite the previous page). For example: `User.pageHTML("<b>Let's play chess!</b>", { name: "chess" })`
- `sendHTML (html: string, opts?: HTMLopts): string | boolean` sends a UHTML box to the user with the specified (optional) options. For example: `User.sendHTML('<b>This is an example.</b>', { change: true })`
- `pageHTML (html: string, opts?: HTMLopts): string | boolean` sends a UHTML box to the user with the specified (optional) options (reusing a name will overwrite the previous page). For example: `User.pageHTML("<b>Let's play chess!</b>", { name: "chess" })`
- `waitFor (condition: (message: Message): boolean, time: number): Promise<Message>` waits for a message from the User. This is resolved when the Client receives a message from the User for which `condition` returns true, and is rejected if (time) milliseconds pass without being resolved. By default, time corresponds to 1 minute - you can set it to 0 to disable the time limit.
- `update (): Promise<User>` updates and resolves with the current user's information after re-fetching from the server.

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ps-client",
"homepage": "https://github.com/PartMan7/PS-Client#readme",
"version": "4.2.0",
"version": "4.3.0",
"description": "Package for connecting to Pokemon Showdown servers.",
"main": "client.js",
"scripts": {
Expand Down

0 comments on commit 09cdee6

Please sign in to comment.