Discord.js welcomer bot recieving users name as 'undefined'
Solution 1:
joinMember
is a GuildMember
and it doesn't have a tag
property. It does have a user
property though and User
s have tag
s, 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] });
});