How to fix welcome message Embed Discord Bot JS

I want to send a welcome message embed, but it says: “channel is not defined”.

This is my code:

client.on('guildMemberAdd', member => {
  let embed = new Discord.MessageEmbed()
    .setTitle("Welcome")
    .setDescription(`Hi ${member}, Welcome to server`)
    .setImage('https://image.ibb.co/dNGVKz/Screenshot_1.png');
  channel.send({embed});
});

Answer

You need to define a channel. You can fetch a channel by ID and send the embed there with the following code:

//Discord.js V13:
client.channels.cache.get(`CHANNELID`).send({ embeds:  })

//Discord.jsV12 (deprecated)
client.channels.cache.get(`CHANNELID`).send(embed)