novaapp-sdk 1.0.1 → 1.0.3
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/dist/index.js +16 -3
- package/dist/index.mjs +16 -3
- package/package.json +12 -3
package/dist/index.js
CHANGED
|
@@ -349,7 +349,7 @@ var NovaClient = class extends import_node_events.EventEmitter {
|
|
|
349
349
|
}
|
|
350
350
|
this.options = {
|
|
351
351
|
token: options.token,
|
|
352
|
-
baseUrl: options.baseUrl ?? "https://
|
|
352
|
+
baseUrl: options.baseUrl ?? "https://novachatapp.com"
|
|
353
353
|
};
|
|
354
354
|
this.http = new HttpClient(this.options.baseUrl, this.options.token);
|
|
355
355
|
this.messages = new MessagesAPI(this.http);
|
|
@@ -357,6 +357,18 @@ var NovaClient = class extends import_node_events.EventEmitter {
|
|
|
357
357
|
this.members = new MembersAPI(this.http);
|
|
358
358
|
this.servers = new ServersAPI(this.http);
|
|
359
359
|
this.interactions = new InteractionsAPI(this.http);
|
|
360
|
+
this.on("error", () => {
|
|
361
|
+
});
|
|
362
|
+
const cleanup = () => this.disconnect();
|
|
363
|
+
process.once("exit", cleanup);
|
|
364
|
+
process.once("SIGINT", () => {
|
|
365
|
+
cleanup();
|
|
366
|
+
process.exit(0);
|
|
367
|
+
});
|
|
368
|
+
process.once("SIGTERM", () => {
|
|
369
|
+
cleanup();
|
|
370
|
+
process.exit(0);
|
|
371
|
+
});
|
|
360
372
|
}
|
|
361
373
|
/**
|
|
362
374
|
* Connect to the Nova WebSocket gateway.
|
|
@@ -378,8 +390,9 @@ var NovaClient = class extends import_node_events.EventEmitter {
|
|
|
378
390
|
reconnectionDelayMax: 3e4
|
|
379
391
|
});
|
|
380
392
|
const onConnectError = (err) => {
|
|
381
|
-
this.
|
|
382
|
-
|
|
393
|
+
this.socket?.disconnect();
|
|
394
|
+
this.socket = null;
|
|
395
|
+
reject(new Error(`[nova-bot-sdk] Gateway connection failed: ${err.message}`));
|
|
383
396
|
};
|
|
384
397
|
this.socket.once("connect_error", onConnectError);
|
|
385
398
|
this.socket.once("bot:ready", (data) => {
|
package/dist/index.mjs
CHANGED
|
@@ -317,7 +317,7 @@ var NovaClient = class extends EventEmitter {
|
|
|
317
317
|
}
|
|
318
318
|
this.options = {
|
|
319
319
|
token: options.token,
|
|
320
|
-
baseUrl: options.baseUrl ?? "https://
|
|
320
|
+
baseUrl: options.baseUrl ?? "https://novachatapp.com"
|
|
321
321
|
};
|
|
322
322
|
this.http = new HttpClient(this.options.baseUrl, this.options.token);
|
|
323
323
|
this.messages = new MessagesAPI(this.http);
|
|
@@ -325,6 +325,18 @@ var NovaClient = class extends EventEmitter {
|
|
|
325
325
|
this.members = new MembersAPI(this.http);
|
|
326
326
|
this.servers = new ServersAPI(this.http);
|
|
327
327
|
this.interactions = new InteractionsAPI(this.http);
|
|
328
|
+
this.on("error", () => {
|
|
329
|
+
});
|
|
330
|
+
const cleanup = () => this.disconnect();
|
|
331
|
+
process.once("exit", cleanup);
|
|
332
|
+
process.once("SIGINT", () => {
|
|
333
|
+
cleanup();
|
|
334
|
+
process.exit(0);
|
|
335
|
+
});
|
|
336
|
+
process.once("SIGTERM", () => {
|
|
337
|
+
cleanup();
|
|
338
|
+
process.exit(0);
|
|
339
|
+
});
|
|
328
340
|
}
|
|
329
341
|
/**
|
|
330
342
|
* Connect to the Nova WebSocket gateway.
|
|
@@ -346,8 +358,9 @@ var NovaClient = class extends EventEmitter {
|
|
|
346
358
|
reconnectionDelayMax: 3e4
|
|
347
359
|
});
|
|
348
360
|
const onConnectError = (err) => {
|
|
349
|
-
this.
|
|
350
|
-
|
|
361
|
+
this.socket?.disconnect();
|
|
362
|
+
this.socket = null;
|
|
363
|
+
reject(new Error(`[nova-bot-sdk] Gateway connection failed: ${err.message}`));
|
|
351
364
|
};
|
|
352
365
|
this.socket.once("connect_error", onConnectError);
|
|
353
366
|
this.socket.once("bot:ready", (data) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "novaapp-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Official SDK for building bots on the Nova platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -12,13 +12,22 @@
|
|
|
12
12
|
"require": "./dist/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"files": [
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
16
19
|
"scripts": {
|
|
17
20
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
18
21
|
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
19
22
|
"typecheck": "tsc --noEmit"
|
|
20
23
|
},
|
|
21
|
-
"keywords": [
|
|
24
|
+
"keywords": [
|
|
25
|
+
"nova",
|
|
26
|
+
"bot",
|
|
27
|
+
"sdk",
|
|
28
|
+
"discord-like",
|
|
29
|
+
"chat"
|
|
30
|
+
],
|
|
22
31
|
"author": "Nova",
|
|
23
32
|
"license": "MIT",
|
|
24
33
|
"dependencies": {
|