From 09cdee6b353602abf8e18c5eb79902c13c1ffe2b Mon Sep 17 00:00:00 2001 From: Parth Mane Date: Fri, 15 Nov 2024 10:35:52 +0530 Subject: [PATCH] upgrade: 4.3.0 --- CHANGELOG.md | 6 ++++++ DOCUMENTATION.md | 16 +++++++++------- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11f6fd1..30d2965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 5d11638..16fe690 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -62,8 +62,8 @@ Message has the following methods: - `reply (text: string): Promise` 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! @@ -86,9 +86,11 @@ Room has the following properties: Room has the following methods: - `send (text: string): Promise` 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('This is an example.', { 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('This is an example.', { 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` 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). @@ -116,8 +118,8 @@ User has the following properties: User has the following methods: - `send (text: string): Promise` 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('This is an example.', { 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("Let's play chess!", { 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('This is an example.', { 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("Let's play chess!", { name: "chess" })` - `waitFor (condition: (message: Message): boolean, time: number): Promise` 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` updates and resolves with the current user's information after re-fetching from the server. diff --git a/package-lock.json b/package-lock.json index 2010b90..449db87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ps-client", - "version": "4.2.0", + "version": "4.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ps-client", - "version": "4.2.0", + "version": "4.3.0", "license": "ISC", "dependencies": { "isomorphic-ws": "^5.0.0", diff --git a/package.json b/package.json index 61ef7f8..4e3dba4 100644 --- a/package.json +++ b/package.json @@ -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": {