Skip to content
Advertisement

member cannot be mentioned in the embed discord.js v13

I was making a join and leave log system that returns a specific embed when someone joins/leaves the server. but when the bot sends the embed in the channel, the member is not mentioned.

My code:

client.on('guildMemberAdd', guildMember =>{

    const embed7 = new MessageEmbed()
    .setAuthor({name: `${guildMember.user.username}`, iconURL: guildMember.displayAvatarURL({dyanmic: true})})
    .addField(`<@${guildMember.id}>`, 'Joined the server')
    .addFields(
        {name: "**💳Member ID**", value: guildMember.id, inline: true},
        {name: "Joined Discord:", value: `<t:${parseInt(guildMember.user.createdTimestamp / 1000, 10)}:R>`, inline: true},
    )
    .setThumbnail(guildMember.displayAvatarURL({dynamic: true}))
    .setColor('GREEN')
    .setTimestamp()
    .setFooter({text: 'Join Log | PDM Building'})
    guildMember.guild.channels.cache.get('948686135264178206').send({embeds: [embed7]})
});
client.on('guildMemberRemove', guildMember => {
    const embed8 = new MessageEmbed()
    .setAuthor({name: guildMember.user.username, iconURL: guildMember.displayAvatarURL({dyanmic: true})})
    .setTitle(`<@${guildMember.user.id}> left the server`)
    .addField(`<@${guildMember.id}>`, 'Left the server')
    .setThumbnail(guildMember.displayAvatarURL({dynamic: true}))
    .setColor('RED')
    .setTimestamp()
    .setFooter({text: 'Leave Log | PDM Building'})
    guildMember.guild.channels.cache.get('948686135264178206').send({embeds: [embed8]})
  });

Notes: No one can see the channel that I am sending this embed to, just me and the bot

I am using discord.js v13 and node.js v16

enter image description here

Advertisement

Answer

You cannot mention a user in an embed title or field header, you can’t a mention user in the embed footer either.

You can do that in the embed description and field values only.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement