Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('voiceStateUpdate', (oldMember, newMember) => {
- var oldVoiceChannel=oldMember.voiceChannel;
- var voiceChannel=newMember.voiceChannel;
- if (voiceChannel){
- if (oldVoiceChannel){
- console.log(newMember.user.tag + " has left voice channel, '" + oldVoiceChannel.name + "' and joined '" + voiceChannel.name + "'!");
- console.log(oldVoiceChannel.name + " now has a user total of: " + oldVoiceChannel.members.array().length);
- }
- else {
- console.log(newMember.user.tag + " has joined voice channel: " + voiceChannel.name + "!");
- }
- if (voiceChannel.id == baseVoiceChannelID){
- function success(result) {
- console.log("It was a success: " + result);
- };
- function fail(error) {
- console.log("It was a failure: " + error);
- };
- console.log(newMember.user.tag + " has joined the special channel! YAY!");
- voiceChannel.clone('TestVoice2', true)
- .then(vc => vc.setParent(voiceChannel.parentID))
- .catch(console.error);
- }
- }
- else if (oldVoiceChannel){
- console.log(newMember.user.tag + " has left voice channel, '" + oldVoiceChannel.name + "'!");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment