简体   繁体   中英

discord.js: How can I make the bot send mention, but not in an embed?

I was working on my join message and was curious how can I make the bot send mention not in an embed, like this: photo

And I Have like this: photo

My current code is:

client.on('guildMemberAdd', async(member) => { // this event gets triggered when a new member joins the server!

    const Channel = member.guild.channels.cache.get('761871578178387989') 
    const embed = new Discord.MessageEmbed()
        .setTitle(`:wave:   Hello ${member.user.tag} and welcome to **${member.guild.name}**.`)
        .setThumbnail(member.user.displayAvatarURL({dynamic: true, size: 512}))
        .addField('Consider checking it!', '**Server IP:** play.aftnetwork.net\n**Store:** https://store.aftnetwork.net\n\n**Make sure to check <#761874528702824469>.**', true)
        .setFooter(`AftNetwork`)
        .setColor('#468DFF')
    // sends a message to the channel
    Channel.send(embed)
})

What should I add to this code to get the wanted result? Help pls <3

You can do that by using the TextChannel.send() method, which accepts an optional options argument ( MessageOptions ) as the second parameter, in which you can specify the embed.


Here's an example:

Channel.send(member, {
    embed: embed,
});
// member is the GuildMember that joined your server and embed is your MessageEmbed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM