discord.js make bot leave voice channel when no user code example
Example 1: discord.js leave voice channel
if(!message.guild.me.voice.channel) return message.channel.send("I'm not in a voice channel"); //If the bot is not in a voice channel, then return a message
message.guild.me.voice.channel.leave(); //Leave the voice channel
Example 2: discord js bot leave voice channel
client.leaveVoiceChannel(message.member.voiceState.channelID);
message.channel.createMessage(`Thanks for tuning in!`);