fix(Guild): remove member's voice state on guildMemberRemove

fixes #2430
This commit is contained in:
Pascal
2018-04-09 17:43:07 +02:00
parent b3ff7c728e
commit b955a514f6
2 changed files with 10 additions and 0 deletions

View File

@@ -1033,6 +1033,15 @@ class VoiceStateCollection extends Collection {
}
super.set(id, voiceState);
}
delete(id) {
const voiceState = this.get(id);
if (voiceState && voiceState.channel_id) {
const channel = this.guild.channels.get(voiceState.channel_id);
if (channel) channel.members.delete(id);
}
return super.delete(id);
}
}
module.exports = Guild;