I
I
iredoff2020-07-20 15:30:00
Node.js
iredoff, 2020-07-20 15:30:00

How to transfer a user from one voice channel to another?

Hello! I wanted to write private voice chats in Discord. Faced a problem.

(node:12956) UnhandledPromiseRejectionWarning: TypeError: New.setVoiceChannel is not a function


the code:
var categoryID = '732115887246671915';
var voiceID = '732115887246671917';

bot.on('voiceStateUpdate',(Old,New)=>{
        if(New.channelID == voiceID){
            New.guild.channels.create(`⭐Room `, { type: 'voice'}).then(set => {
                set.setParent(New.guild.channels.cache.get(categoryID));
                New.setVoiceChannel(New.guild.channels.cache.get(set.id))
            });
        }
    });


I'm using the latest version of discord.js (12.2.0). Thank you in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-07-20
@Alexandre888

the error is self-explanatory: attribute does not exist setVoiceChannely New
use attribute.setChannel

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question