@discordjs/voice 0.11.0-dev.1655942958-7279f9c → 0.11.0-dev.1656060476-e24970e

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.ts CHANGED
@@ -209,6 +209,27 @@ declare class AudioPlayerError extends Error {
209
209
  constructor(error: Error, resource: AudioResource);
210
210
  }
211
211
 
212
+ /**
213
+ * Represents a subscription of a voice connection to an audio player, allowing
214
+ * the audio player to play audio on the voice connection.
215
+ */
216
+ declare class PlayerSubscription {
217
+ /**
218
+ * The voice connection of this subscription.
219
+ */
220
+ readonly connection: VoiceConnection;
221
+ /**
222
+ * The audio player of this subscription.
223
+ */
224
+ readonly player: AudioPlayer;
225
+ constructor(connection: VoiceConnection, player: AudioPlayer);
226
+ /**
227
+ * Unsubscribes the connection from the audio player, meaning that the
228
+ * audio player cannot stream audio to it until a new subscription is made.
229
+ */
230
+ unsubscribe(): void;
231
+ }
232
+
212
233
  /**
213
234
  * Describes the behavior of the player when an audio packet is played but there are no available
214
235
  * voice connections to play to.
@@ -329,10 +350,31 @@ declare type AudioPlayerState = AudioPlayerIdleState | AudioPlayerBufferingState
329
350
  interface AudioPlayer extends EventEmitter {
330
351
  /**
331
352
  * Emitted when there is an error emitted from the audio resource played by the audio player
332
- *
333
353
  * @event
334
354
  */
335
- on: (event: 'error', listener: (error: AudioPlayerError) => void) => this;
355
+ on(event: 'error', listener: (error: AudioPlayerError) => void): this;
356
+ /**
357
+ * Emitted debugging information about the audio player
358
+ * @event
359
+ */
360
+ on(event: 'debug', listener: (message: string) => void): this;
361
+ /**
362
+ * Emitted when the state of the audio player changes
363
+ * @event
364
+ */
365
+ on(event: 'stateChange', listener: (oldState: AudioPlayerState, newState: AudioPlayerState) => void): this;
366
+ /**
367
+ * Emitted when the audio player is subscribed to a voice connection
368
+ * @event
369
+ */
370
+ on(event: 'subscribe' | 'unsubscribe', listener: (subscription: PlayerSubscription) => void): this;
371
+ /**
372
+ * Emitted when the status of state changes to a specific status
373
+ * @event
374
+ */
375
+ on<T extends AudioPlayerStatus>(event: T, listener: (oldState: AudioPlayerState, newState: AudioPlayerState & {
376
+ status: T;
377
+ }) => void): this;
336
378
  }
337
379
  /**
338
380
  * Used to play audio resources (i.e. tracks, streams) to voice connections.
@@ -476,27 +518,6 @@ declare class AudioPlayer extends EventEmitter {
476
518
  */
477
519
  declare function createAudioPlayer(options?: CreateAudioPlayerOptions): AudioPlayer;
478
520
 
479
- /**
480
- * Represents a subscription of a voice connection to an audio player, allowing
481
- * the audio player to play audio on the voice connection.
482
- */
483
- declare class PlayerSubscription {
484
- /**
485
- * The voice connection of this subscription.
486
- */
487
- readonly connection: VoiceConnection;
488
- /**
489
- * The audio player of this subscription.
490
- */
491
- readonly player: AudioPlayer;
492
- constructor(connection: VoiceConnection, player: AudioPlayer);
493
- /**
494
- * Unsubscribes the connection from the audio player, meaning that the
495
- * audio player cannot stream audio to it until a new subscription is made.
496
- */
497
- unsubscribe(): void;
498
- }
499
-
500
521
  interface JoinConfig {
501
522
  guildId: string;
502
523
  channelId: string | null;
@@ -545,6 +566,12 @@ interface SocketConfig {
545
566
  ip: string;
546
567
  port: number;
547
568
  }
569
+ interface VoiceUDPSocket extends EventEmitter$1 {
570
+ on(event: 'error', listener: (error: Error) => void): this;
571
+ on(event: 'close', listener: () => void): this;
572
+ on(event: 'debug', listener: (message: string) => void): this;
573
+ on(event: 'message', listener: (message: Buffer) => void): this;
574
+ }
548
575
  /**
549
576
  * Manages the UDP networking for a voice connection.
550
577
  */
@@ -1009,6 +1036,11 @@ interface VoiceUserData {
1009
1036
  */
1010
1037
  userId: string;
1011
1038
  }
1039
+ interface SSRCMap extends EventEmitter$1 {
1040
+ on(event: 'create', listener: (newData: VoiceUserData) => void): this;
1041
+ on(event: 'update', listener: (oldData: VoiceUserData | undefined, newData: VoiceUserData) => void): this;
1042
+ on(event: 'delete', listener: (deletedData: VoiceUserData) => void): this;
1043
+ }
1012
1044
  /**
1013
1045
  * Maps audio SSRCs to data of users in voice connections.
1014
1046
  */
@@ -1040,6 +1072,13 @@ declare class SSRCMap extends EventEmitter$1 {
1040
1072
  delete(target: number | string): VoiceUserData | undefined;
1041
1073
  }
1042
1074
 
1075
+ interface SpeakingMap extends EventEmitter$1 {
1076
+ /**
1077
+ * Emitted when a user starts/stops speaking.
1078
+ * @event
1079
+ */
1080
+ on: (event: 'start' | 'end', listener: (userId: string) => void) => this;
1081
+ }
1043
1082
  /**
1044
1083
  * Tracks the speaking states of users in a voice channel.
1045
1084
  */
@@ -1293,6 +1332,30 @@ interface VoiceConnectionDestroyedState {
1293
1332
  * The various states that a voice connection can be in.
1294
1333
  */
1295
1334
  declare type VoiceConnectionState = VoiceConnectionSignallingState | VoiceConnectionDisconnectedState | VoiceConnectionConnectingState | VoiceConnectionReadyState | VoiceConnectionDestroyedState;
1335
+ interface VoiceConnection extends EventEmitter$1 {
1336
+ /**
1337
+ * Emitted when there is an error emitted from the voice connection
1338
+ * @event
1339
+ */
1340
+ on(event: 'error', listener: (error: Error) => void): this;
1341
+ /**
1342
+ * Emitted debugging information about the voice connection
1343
+ * @event
1344
+ */
1345
+ on(event: 'debug', listener: (message: string) => void): this;
1346
+ /**
1347
+ * Emitted when the state of the voice connection changes
1348
+ * @event
1349
+ */
1350
+ on(event: 'stateChange', listener: (oldState: VoiceConnectionState, newState: VoiceConnectionState) => void): this;
1351
+ /**
1352
+ * Emitted when the state of the voice connection changes to a specific status
1353
+ * @event
1354
+ */
1355
+ on<T extends VoiceConnectionStatus>(event: T, listener: (oldState: VoiceConnectionState, newState: VoiceConnectionState & {
1356
+ status: T;
1357
+ }) => void): this;
1358
+ }
1296
1359
  /**
1297
1360
  * A connection to the voice server of a Guild, can be used to play audio in voice channels.
1298
1361
  */
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ var require_package = __commonJS({
35
35
  "package.json"(exports, module2) {
36
36
  module2.exports = {
37
37
  name: "@discordjs/voice",
38
- version: "0.11.0-dev.1655942958-7279f9c",
38
+ version: "0.11.0-dev.1656060476-e24970e",
39
39
  description: "Implementation of the Discord Voice API for node.js",
40
40
  scripts: {
41
41
  build: "tsup && node scripts/postbuild.mjs",