如何在机器人消息中提及用户名

How to mention username in bot message

我试图标记用户而不是提到的 ID(我试过 ${user.username} )但它实际上仍然没有提到命令运行的所述用户

目前命令是 $cake "User tag" 但机器人不会实际提及他们,而是只写下他们的用户名或者在末尾包含鉴别器。

所以代码是

      recentUsers.push(message.author.id);
  setTimeout(() => {
    recentUsers.splice(recentUsers.indexOf(message.author.id), 1);
  }, COOLDOWN * 60 * 60 * 1000);

  message.channel.send({
    embed: {
      color: Cuckbot.colors.GREEN,
      description: ` You have given one cake to ${user.id} `

如果您尝试这样发送 (而不是 user.id,只需 user:

description: ` You have given one cake to ${user} `

它会将用户转换为字符串,并且这种转换(使用 DiscordJS)使其值得一提。
我不确定它是否真的会提及用户(通过通知),但它肯定会使其可点击。