discord js connect to voice channel code example

Example 1: discord.js join voice channel

if(!message.member.voice.channel) return message.channel.send("Please connect to a voice channel!"); //If you are not in the voice channel, then return a message
message.member.voice.channel.join(); //Join the voice channel

Example 2: discord js channel connect

client.on('message', message => {
    if (message.author.bot) return;
    if (message.channel.id === '2ND CHANNEL ID'){
        const Messager = message.author.username;
        const GlobalMessage = message.content;
        const GlobalSender = client.channels.cache.find(channel => channel.id === '1ST CHANNEL ID')
        const EmoGlobalChatEmbed = new Discord.MessageEmbed()
            .setColor('#b700ff')
            .setTitle("Message From : " + Messager)
            .addField(" \u200B ", GlobalMessage)
            .setFooter('Best, Emo', 'https://i.ibb.co/qjgWyQP/emo.png');
            message.channel.send("Message Executed")
        message.channel.send(EmoGlobalChatEmbed);
        GlobalSender.send("**New Message : **")
        GlobalSender.send(EmoGlobalChatEmbed)
        message.delete()
    } else if (message.channel.id === '1ST CHANNEL ID') {
        const Messager = message.author.username;
        const GlobalMessage = message.content;
        const GlobalSender = client.channels.cache.find(channel => channel.id === '2ND CHANNEL ID')
        const EmoGlobalChatEmbed = new Discord.MessageEmbed()
            .setColor('#b700ff')
            .setTitle("Message From : " + Messager)
            .addField(" \u200B ", GlobalMessage)
            .setFooter('Best, Emo', 'https://i.ibb.co/qjgWyQP/emo.png');
        message.channel.send("Message Executed")
        message.channel.send(EmoGlobalChatEmbed);
        GlobalSender.send("**New Message : **")
        GlobalSender.send(EmoGlobalChatEmbed)
        message.delete()
    }
})