@squord/sdk 0.1.0 → 0.2.0
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 +3 -3
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ npm install @squord/sdk # ESM e CommonJS, tipos incluídos
|
|
|
100
100
|
|
|
101
101
|
```jsonc
|
|
102
102
|
// package.json consumer, se estiver no Node 20:
|
|
103
|
-
{ "dependencies": { "@squord/sdk": "^0.
|
|
103
|
+
{ "dependencies": { "@squord/sdk": "^0.2.0", "ws": "^8" } }
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
```ts
|
|
@@ -531,8 +531,8 @@ repositório):
|
|
|
531
531
|
|
|
532
532
|
```bash
|
|
533
533
|
git clone https://github.com/Squord/squord-sdk && cd squord-sdk
|
|
534
|
-
pnpm install && pnpm pack # gera packages/sdk/squord-sdk-0.
|
|
535
|
-
npm install /caminho/para/squord-sdk-0.
|
|
534
|
+
pnpm install && pnpm pack # gera packages/sdk/squord-sdk-0.2.0.tgz
|
|
535
|
+
npm install /caminho/para/squord-sdk-0.2.0.tgz
|
|
536
536
|
```
|
|
537
537
|
|
|
538
538
|
---
|
package/dist/index.cjs
CHANGED
|
@@ -1162,6 +1162,22 @@ var MessagesManager = class {
|
|
|
1162
1162
|
delete(channelId, messageId, options = {}) {
|
|
1163
1163
|
return this.rest.delete(`/channels/${channelId}/messages/${messageId}`, { signal: options.signal }).then(() => void 0);
|
|
1164
1164
|
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Apaga até 100 mensagens do canal numa chamada (`MANAGE_MESSAGES`). Devolve os ids que foram
|
|
1167
|
+
* apagados: ids inexistentes, já apagados ou de outro canal são ignorados pelo servidor.
|
|
1168
|
+
*/
|
|
1169
|
+
async bulkDelete(channelId, messageIds, options = {}) {
|
|
1170
|
+
if (messageIds.length < 1 || messageIds.length > 100) {
|
|
1171
|
+
throw new SquordTypeError("bulkDelete aceita de 1 a 100 ids");
|
|
1172
|
+
}
|
|
1173
|
+
const response = await this.rest.post(
|
|
1174
|
+
`/channels/${channelId}/messages/bulk-delete`,
|
|
1175
|
+
{ messageIds },
|
|
1176
|
+
// Repetir não apaga nada duas vezes: ids já apagados são ignorados.
|
|
1177
|
+
{ signal: options.signal, retryable: true }
|
|
1178
|
+
);
|
|
1179
|
+
return response.messageIds;
|
|
1180
|
+
}
|
|
1165
1181
|
/** Reage a uma mensagem (`ADD_REACTIONS`). `emoji` é o caractere ou `<:nome:id>`. */
|
|
1166
1182
|
react(channelId, messageId, emoji, options = {}) {
|
|
1167
1183
|
return this.rest.put(
|