fix(GuildMember): make edit method only modify a copy of the voice state

This is to fix stale members in voice channels.
This commit is contained in:
Pascal 2018-01-20 12:44:27 +01:00
parent a22b856494
commit fbd25f8677
No known key found for this signature in database
GPG key ID: 8C8A2E338661B871

View file

@ -357,7 +357,8 @@ class GuildMember extends Base {
const clone = this._clone();
data.user = this.user;
clone._patch(data);
clone._frozenVoiceState = this.voiceState;
clone._frozenVoiceState = {};
Object.assign(clone._frozenVoiceState, this.voiceState);
if (typeof data.mute !== 'undefined') clone._frozenVoiceState.mute = data.mute;
if (typeof data.deaf !== 'undefined') clone._frozenVoiceState.mute = data.deaf;
if (typeof data.channel_id !== 'undefined') clone._frozenVoiceState.channel_id = data.channel_id;