problems occurred when i try to do a discord bot autoVoiceChannel

github logo ・1 min read

Hello i try to create a Auto Voice channel .
When you join a channel (New channel)
the bot gonna create a new channel like (First-Channel)
and when you leave he gonna delete him

To create a new channel i need the

bot.on('message', async msg => {

msg.guild.createChannel('First-channel', "voice")


But i want to do

bot.on('voiceStateUpdate', async (oldMember, newMember, ) => {

let newUserChannel = newMember.voiceChannel
let oldUserChannel = oldMember.voiceChannel

if (oldUserChannel === undefined && newUserChannel !== undefined) {

// here is when you join a channel and i want to put the
msg.guild.createChannel('First-Channel', "voice")

here but is not possible can you help me ?

} else if (newUserChannel === undefined) {

// Here is when you leave channel



Thanks you and sry for my bad english

twitter logo DISCUSS
Classic DEV Post from Feb 16

What Do You Find Difficult about SQL and Databases?

What Do You Find Difficult about SQL and Databases?

captainjuzo profile image
hello i am juzzo and i am a french web dev and i do some discord bot