mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
chore: monorepo setup (#7175)
This commit is contained in:
33
packages/voice/src/audio/PlayerSubscription.ts
Normal file
33
packages/voice/src/audio/PlayerSubscription.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/* eslint-disable @typescript-eslint/dot-notation */
|
||||
import type { VoiceConnection } from '../VoiceConnection';
|
||||
import type { AudioPlayer } from './AudioPlayer';
|
||||
|
||||
/**
|
||||
* Represents a subscription of a voice connection to an audio player, allowing
|
||||
* the audio player to play audio on the voice connection.
|
||||
*/
|
||||
export class PlayerSubscription {
|
||||
/**
|
||||
* The voice connection of this subscription.
|
||||
*/
|
||||
public readonly connection: VoiceConnection;
|
||||
|
||||
/**
|
||||
* The audio player of this subscription.
|
||||
*/
|
||||
public readonly player: AudioPlayer;
|
||||
|
||||
public constructor(connection: VoiceConnection, player: AudioPlayer) {
|
||||
this.connection = connection;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribes the connection from the audio player, meaning that the
|
||||
* audio player cannot stream audio to it until a new subscription is made.
|
||||
*/
|
||||
public unsubscribe() {
|
||||
this.connection['onSubscriptionRemoved'](this);
|
||||
this.player['unsubscribe'](this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user