they changed voiceStateUpdate

This commit is contained in:
Lamp 2018-08-15 13:10:51 -07:00
parent 76bf1c636c
commit 0592a2b562
No known key found for this signature in database
GPG Key ID: 0F1F8704BEDE369E
1 changed files with 5 additions and 5 deletions

View File

@ -16,13 +16,13 @@
(async function(){ (async function(){
var vcid = config.channels.voice; var vcid = config.channels.voice;
var rid = config.roles.viewing_deleted_channels; var rid = config.roles.viewing_deleted_channels;
dClient.on('voiceStateUpdate', async (oldMember, newMember) => { dClient.on('voiceStateUpdate', async (oldState, newState) => {
if (oldMember.voiceChannelID != vcid && newMember.voiceChannelID == vcid) { if (oldState.channelID != vcid && newState.channelID == vcid) {
// member joined the channel // member joined the channel
newMember.roles.add(newMember.guild.roles.get(rid)); newState.member.roles.add(newState.member.guild.roles.get(rid));
} else if (oldMember.voiceChannelID == vcid && newMember.voiceChannelID != vcid) { } else if (oldState.channelI == vcid && newState.channelID != vcid) {
// member left the channel // member left the channel
newMember.roles.remove(newMember.guild.roles.get(rid)); newState.member.roles.remove(newState.member.guild.roles.get(rid));
} }
}); });
})(); })();