The problem is that Discord bot doesn't send the greeting message when a new member joins.
node version is 16
discord.js is v13
The terminal shows no errors. And this is the code:
bot.on('ready', () =>{
console.log('This bot is online!');
})
bot.on('guildMemberAdd', guildMember=>{
const User = guildMember.user
const channel = guildMember.guild.channels.cache.find(channel => channel.id == '798928691988004897');
console.log(User)
const embed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Welcome')
.setDescription(`Welcome to the server <@${User.id}>`)
.setThumbnail(`${User.avatarURL()}`)
channel.send({embeds :[embed]});
});
Looks like you do not have the "guild member" intents enabled for the bot to detect changes made to guild members
go to Discord Developer Portal and navigate to your application and enable server member intent

And you need to have this intent enabled within your code as well
const { Intents, Client } = require('discord.js'); // require other classes as per your bot needs
const intents = [Intents.FLAGS.GUILD_MEMBERS]; // Add other related intents
const bot = new Client({ intents: intents });
// finish your code with events and stuff