feat: @discordjs/voice

This commit is contained in:
Snowflake107 2021-06-11 15:13:21 +05:45
parent a0d3859230
commit 3378d5cfd7
3 changed files with 12 additions and 3 deletions

View file

@ -93,6 +93,13 @@ class VoiceSubscription extends EventEmitter<VoiceEvents> {
return this.audioPlayer.state.status;
}
/**
* Disconnects from voice
*/
disconnect() {
this.voiceConnection.destroy();
}
/**
* Stops the player
*/

View file

@ -40,8 +40,9 @@ class VoiceUtils {
* Disconnects voice connection
* @param {VoiceConnection} connection The voice connection
*/
public static disconnect(connection: VoiceConnection) {
connection.destroy();
public static disconnect(connection: VoiceConnection | VoiceSubscription) {
if (connection instanceof VoiceSubscription) return connection.voiceConnection.destroy();
else connection.destroy();
}
}

View file

@ -1 +1,2 @@
export {};
export { VoiceUtils } from "./VoiceInterface/VoiceUtils";
export { VoiceEvents, VoiceSubscription } from "./VoiceInterface/VoiceSubscription";