@sonata-sdk/voice 0.1.0 → 0.1.1

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.
@@ -22,6 +22,7 @@ export declare class VoiceConnection extends EventEmitter implements IVoiceConne
22
22
  channel_id?: string;
23
23
  channelId?: string;
24
24
  }): void;
25
+ connect(): void;
25
26
  sendAudioFrame(frame: Buffer): void;
26
27
  setSpeaking(value: number): void;
27
28
  destroy(): void;
@@ -49,7 +49,7 @@ export class VoiceConnection extends EventEmitter {
49
49
  this.emit('ready');
50
50
  });
51
51
  this.#gateway.on('close', (code, reason) => {
52
- this.state = { status: 'disconnected', reason, code };
52
+ this.state = { status: 'disconnected', reason, code, closeReason: reason };
53
53
  this.emit('stateChange', { status: 'connected' }, this.state);
54
54
  });
55
55
  this.#gateway.on('error', (err) => this.emit('error', err));
@@ -67,6 +67,8 @@ export class VoiceConnection extends EventEmitter {
67
67
  this.#token = obj.token;
68
68
  this.#endpoint = obj.endpoint;
69
69
  this.#gateway.voiceServerUpdate(obj.token, obj.endpoint, obj.channelId ?? obj.channel_id);
70
+ }
71
+ connect() {
70
72
  this.#gateway.connect();
71
73
  }
72
74
  sendAudioFrame(frame) {
package/dist/types.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface ConnectionState {
10
10
  status: 'connecting' | 'connected' | 'disconnected' | 'destroyed';
11
11
  reason: string | null;
12
12
  code: number | null;
13
+ closeReason?: string | null;
13
14
  }
14
15
  export interface PlayerState {
15
16
  status: 'playing' | 'paused' | 'stopped';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonata-sdk/voice",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Discord voice connection library — WebSocket gateway, UDP, RTP, encryption, DAVE/MLS",
5
5
  "license": "MIT",
6
6
  "type": "module",