Discord.JS V12提到用户中间立场

时间:2020-05-19 04:43:36

标签: discord.js

因此,我将我的漫游器更新为V11中的V12,+message.author.username+中提到了用户,但在V12中没有。我在V12中使用Person: Donated 10 coins to @user使用+message.author.username的命令显示Person: DOnated 10 coins to user

这是代码

const Jwork = require('../../beg.json');
  const JworkR = Jwork[Math.floor(Math.random() * Jwork.length)];
  var random = Math.floor(Math.random() * 20) + 3;
  let curBal = bal[message.author.id].balance 
  bal[message.author.id].balance = curBal + random;
  fs.writeFile('././database/balance.json', JSON.stringify(bal, null, 2), (err) => {
    message.channel.send(`
    **${JworkR}** has donated ${random} coins to ` +message.author.username+ `!`)
    if (err) console.log(err)
  });

我需要做些什么才能使它提及用户吗?

1 个答案:

答案 0 :(得分:2)

"<@" + msg.author.id + ">"
`<@${msg.author.id}>`

工程,您也可以进行msg.reply(),但是它具有固定的格式