简体   繁体   English

discord.js:如何让机器人发送提及,但不在嵌入中?

[英]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请帮助<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.您可以使用TextChannel.send()方法来做到这一点,该方法接受可选的options参数 ( MessageOptions ) 作为第二个参数,您可以在其中指定嵌入。


Here's an example:这是一个例子:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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