I've tried for a while but for some reason my Discord server welcome message isn't working. If anyone could help it would be much appreciated. Here's my code :
bot.on("guildMemberAdd", member => {
const welcomeChannel = member.guild.channels.cache.find(channel => channel.name === 'welcome')
var serverIcon = message.guild.iconURL();
const embed = new Discord.MessageEmbed()
.setTitle("Welcome!")
.setColor(3447003)
.setDescription(`Welcome <${member.user.username}> to ${guild.name}!`)
.addField(
{ name: ':D', value: 'Hope you enjoy your stay!'}
)
.setFooter("© Ninjabot 2020", bot.user.avatarURL)
.setThumbnail(serverIcon)
.setTimestamp()
welcomeChannel.send({embed});
})