@jnode/discord 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -77,7 +77,13 @@ new discord.Client(token, options = {})
77
77
  - `method`: HTTP method (e.g. `GET`, `POST`, `PUT`, `DELETE`). Default is `GET`.
78
78
  - `path`: API endpoint path. Default is `/`. Example: `/channels/123456789/messages`.
79
79
  - `body`: Request body data (will be stringified). Example: `{ content: 'Hello, Discord!' }`.
80
- - `attachments`: An array of attachments, each attachment is an object like: `{ name: 'file.png', type: 'image/png', data: Buffer, encoded: base64 or undefined }`.
80
+ - `attachments`: An array of attachments, each attachment is an object:
81
+ - `name`: Name of the file. Example: `image.png`
82
+ - `type` (Optional): Content type of the data. Defaults to `application/octet-stream`.
83
+ - `data` (Option 1): Data (string or Buffer) of this file.
84
+ - `file` (Option 2): Path to a local file.
85
+ - `encoded`/`base64` (Option 3): base64 encoded data string.
86
+ - `stream` (Option 4): Any readable stream.
81
87
  - **Returns**: `Promise<RequestResponse>` - A promise that resolves to a `RequestResponse` object.
82
88
  - **Example**:
83
89
  ```js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jnode/discord",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Simple Discord API package for Node.js.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -86,7 +86,9 @@ class DiscordClient {
86
86
  disposition: `form-data; name="files[${i}]"; filename="${encodeURIComponent(attachments[i].name)}"`,
87
87
  type: attachments[i].type,
88
88
  data: attachments[i].data,
89
- base64: attachments[i].encoded
89
+ base64: attachments[i].encoded ?? attachments[i].base64,
90
+ stream: attachments[i].stream,
91
+ file: attachments[i].file
90
92
  });
91
93
  }
92
94