我尝试了下面的方法,但我得到了错误:“msg.montions.users.first.addRole不是函数”
let BotBanRole = msg.guild.roles.cache.find(r => r.id === "973182673306660885");
const FMT = msg.mentions.users.first();
if (msg.content.startsWith('$BotBan')) {
if (FMT === undefined) {
msg.reply('Did not detect user')
return; // Do not proceed, there is no user.
}
const FM = FMT.username;
// Do stuff with the username
msg.mentions.users.first.addRole(BotBanRole);
msg.reply('Bot Banned ' + FM.tag)
}
2条答案
按热度按时间nzk0hqpo1#
你很接近,试试看。
9bfwbjaz2#
我编辑了你的代码,如果是v13,它的工作原理是这样的。