feat(Voice): implement support for @discordjs/voice (#5402)

This commit is contained in:
Amish Shah
2021-06-09 14:21:19 +01:00
committed by GitHub
parent c4f1c75efa
commit 7b2e12b102
27 changed files with 99 additions and 2395 deletions

View File

@@ -66,30 +66,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
return true;
}
/**
* Attempts to join this voice-based channel.
* @returns {Promise<VoiceConnection>}
* @example
* // Join a voice-based channel
* channel.join()
* .then(connection => console.log('Connected!'))
* .catch(console.error);
*/
join() {
return this.client.voice.joinChannel(this);
}
/**
* Leaves this voice-based channel.
* @example
* // Leave a voice-based channel
* channel.leave();
*/
leave() {
const connection = this.client.voice.connections.get(this.guild.id);
if (connection?.channel.id === this.id) connection.disconnect();
}
/**
* Sets the RTC region of the channel.
* @param {?string} region The new region of the channel. Set to `null` to remove a specific region for the channel