they changed voiceStateUpdate
This commit is contained in:
parent
76bf1c636c
commit
0592a2b562
10
src/misc.js
10
src/misc.js
|
@ -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));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
Loading…
Reference in New Issue