I'm trying to make a welcomer bot, it all works but for some reason, the user who joined's name is undefined. Here's the code:
client.on('guildMemberAdd', (joinMember) => {
const joinChannel = client.channels.cache.find(channel => channel.id === '931712815637602331')
let joinEmbed = {
title : `Welcome to ${joinMember.guild.name}, @${joinMember.tag}`,
color : embedColor
}
joinChannel.send({embeds : [joinEmbed]})
})
joinMember is a GuildMember and it doesn't have a tag property. It does have a user property though and Users have tags, so you can use joinMember.user.tag:
client.on('guildMemberAdd', (joinMember) => {
const joinChannel = client.channels.cache.get('931712815637602331');
let joinEmbed = {
title: `Welcome to ${joinMember.guild.name}, @${joinMember.user.tag}`,
color: embedColor,
};
joinChannel.send({ embeds: [joinEmbed] });
});