novaapp-sdk 1.0.3 → 1.0.5
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.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +15 -3
- package/dist/index.mjs +15 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -25,6 +25,10 @@ interface BotUser {
|
|
|
25
25
|
interface BotApplication {
|
|
26
26
|
id: string;
|
|
27
27
|
name: string;
|
|
28
|
+
/** Convenience: same as botUser.username */
|
|
29
|
+
username: string;
|
|
30
|
+
/** Convenience: same as botUser.displayName */
|
|
31
|
+
displayName: string;
|
|
28
32
|
description: string | null;
|
|
29
33
|
avatar: string | null;
|
|
30
34
|
category: string | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ interface BotUser {
|
|
|
25
25
|
interface BotApplication {
|
|
26
26
|
id: string;
|
|
27
27
|
name: string;
|
|
28
|
+
/** Convenience: same as botUser.username */
|
|
29
|
+
username: string;
|
|
30
|
+
/** Convenience: same as botUser.displayName */
|
|
31
|
+
displayName: string;
|
|
28
32
|
description: string | null;
|
|
29
33
|
avatar: string | null;
|
|
30
34
|
category: string | null;
|
package/dist/index.js
CHANGED
|
@@ -397,7 +397,13 @@ var NovaClient = class extends import_node_events.EventEmitter {
|
|
|
397
397
|
this.socket.once("connect_error", onConnectError);
|
|
398
398
|
this.socket.once("bot:ready", (data) => {
|
|
399
399
|
this.socket.off("connect_error", onConnectError);
|
|
400
|
-
this.botUser = {
|
|
400
|
+
this.botUser = {
|
|
401
|
+
...data.bot,
|
|
402
|
+
scopes: data.scopes,
|
|
403
|
+
// Flatten botUser fields for convenience so bot.username works
|
|
404
|
+
username: data.bot.botUser?.username ?? data.bot.name,
|
|
405
|
+
displayName: data.bot.botUser?.displayName ?? data.bot.name
|
|
406
|
+
};
|
|
401
407
|
this.emit("ready", this.botUser);
|
|
402
408
|
resolve();
|
|
403
409
|
});
|
|
@@ -423,8 +429,14 @@ var NovaClient = class extends import_node_events.EventEmitter {
|
|
|
423
429
|
* Disconnect from the gateway and clean up.
|
|
424
430
|
*/
|
|
425
431
|
disconnect() {
|
|
426
|
-
this.socket
|
|
427
|
-
|
|
432
|
+
if (this.socket) {
|
|
433
|
+
try {
|
|
434
|
+
this.socket.io.reconnection(false);
|
|
435
|
+
} catch {
|
|
436
|
+
}
|
|
437
|
+
this.socket.disconnect();
|
|
438
|
+
this.socket = null;
|
|
439
|
+
}
|
|
428
440
|
}
|
|
429
441
|
/**
|
|
430
442
|
* Send a message via the WebSocket gateway (lower latency than HTTP).
|
package/dist/index.mjs
CHANGED
|
@@ -365,7 +365,13 @@ var NovaClient = class extends EventEmitter {
|
|
|
365
365
|
this.socket.once("connect_error", onConnectError);
|
|
366
366
|
this.socket.once("bot:ready", (data) => {
|
|
367
367
|
this.socket.off("connect_error", onConnectError);
|
|
368
|
-
this.botUser = {
|
|
368
|
+
this.botUser = {
|
|
369
|
+
...data.bot,
|
|
370
|
+
scopes: data.scopes,
|
|
371
|
+
// Flatten botUser fields for convenience so bot.username works
|
|
372
|
+
username: data.bot.botUser?.username ?? data.bot.name,
|
|
373
|
+
displayName: data.bot.botUser?.displayName ?? data.bot.name
|
|
374
|
+
};
|
|
369
375
|
this.emit("ready", this.botUser);
|
|
370
376
|
resolve();
|
|
371
377
|
});
|
|
@@ -391,8 +397,14 @@ var NovaClient = class extends EventEmitter {
|
|
|
391
397
|
* Disconnect from the gateway and clean up.
|
|
392
398
|
*/
|
|
393
399
|
disconnect() {
|
|
394
|
-
this.socket
|
|
395
|
-
|
|
400
|
+
if (this.socket) {
|
|
401
|
+
try {
|
|
402
|
+
this.socket.io.reconnection(false);
|
|
403
|
+
} catch {
|
|
404
|
+
}
|
|
405
|
+
this.socket.disconnect();
|
|
406
|
+
this.socket = null;
|
|
407
|
+
}
|
|
396
408
|
}
|
|
397
409
|
/**
|
|
398
410
|
* Send a message via the WebSocket gateway (lower latency than HTTP).
|