试图让我的discord.js机器人提及用户

时间:2018-10-16 23:05:18

标签: discord discord.js

我最近一直在尝试找出如何通过在消息中标记新用户来吸引我的discord.js机器人来欢迎新用户,但是它只是@user 与他们的鉴别器一起出现< / em>。任何帮助/建议,将不胜感激。

代码如下:

    client.on("guildMemberAdd", (member) => {
  let guild = member.guild;
  let memberTag = member.user.tag;
  if(guild.systemChannel){
    guild.systemChannel.send("@" + memberTag + "  has joined the server!")
  }
});

1 个答案:

答案 0 :(得分:1)

根据我的个人经验,我一直使用全局提及方法,即使用<@id-of-the-user>。如果这是您要尝试的方法,请更改 guild.systemChannel.send("@" + memberTag + " has joined the server!")guild.systemChannel.send("<@" + member.id + "> has joined the server!")