discord bot join voice channel javascript code example
Example: Discord.js Get A Bot To Join A Music Chanel
client.on("ready", () => {
const channel = client.channels.get("mychannelid");
if (!channel) return console.error("The channel does not exist!");
channel.join().then(connection => {
// Yay, it worked!
console.log("Successfully connected.");
}).catch(e => {
// Oh no, it errored! Let's log it to console :)
console.error(e);
});
});