bot.on('guildMemberAdd', member =>{
const welcomeEmbed = new Discord.MessageEmbed()
.setTitle(`A new user has joined the server, everyone welcome ${member.user}!`)
const channel = member.guild.channels.cache.find(channel => channel.name === "welcome-channel");
if(!channel) return;
channel.send(welcomeEmbed)
});
答案 0 :(得分:4)
这是因为您无法在嵌入标题中提及某人,
所以它的作用是将其转换为user_id模式,例如<@id_here>
使用用户类来提及某人为实际消息工作,例如:
message.chanenl.send(`${message.user} hey`);
那会提到用户,并回答“嘿”,
但是就像我之前在嵌入标题中所说的,你不能提及某人。
所以最好的选择是使用他们的用户名:
const welcomeEmbed = new Discord.MessageEmbed()
.setTitle(`A new user has joined the server, everyone welcome ${member.user.username}!`);
答案 1 :(得分:0)
如果您想提及他们,可以使用他们的ID:
const welcomeEmbed = new Discord.MessageEmbed()
.setTitle(`A new user has joined the server, everyone welcome <@${member.id}>!`);