mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
feat(VoiceState): self mute/deaf methods (#3243)
* Implemented setSelfMute/Deaf, done typings, fixed bug in VoiceState with errors. * Completed requested changes * return send in sendVoiceStateUpdate so its a promise, update typings * Updated methods to return a boolean * Requested changes * Fix bug * Update src/structures/VoiceState.js Co-Authored-By: MrJacz <23615291+MrJacz@users.noreply.github.com> * fix
This commit is contained in:
@@ -177,20 +177,21 @@ class VoiceConnection extends EventEmitter {
|
||||
/**
|
||||
* Sends a request to the main gateway to join a voice channel.
|
||||
* @param {Object} [options] The options to provide
|
||||
* @returns {Promise<Shard>}
|
||||
* @private
|
||||
*/
|
||||
sendVoiceStateUpdate(options = {}) {
|
||||
options = Util.mergeDefault({
|
||||
guild_id: this.channel.guild.id,
|
||||
channel_id: this.channel.id,
|
||||
self_mute: false,
|
||||
self_deaf: false,
|
||||
self_mute: this.voice ? this.voice.selfMute : false,
|
||||
self_deaf: this.voice ? this.voice.selfDeaf : false,
|
||||
}, options);
|
||||
|
||||
const queueLength = this.channel.guild.shard.ratelimit.queue.length;
|
||||
this.emit('debug', `Sending voice state update (queue length is ${queueLength}): ${JSON.stringify(options)}`);
|
||||
|
||||
this.channel.guild.shard.send({
|
||||
return this.channel.guild.shard.send({
|
||||
op: OPCodes.VOICE_STATE_UPDATE,
|
||||
d: options,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user