检查提到的个人资料是否是机器人

Check if mentioned profile is a bot

所以我正在制作一个 Discord 机器人,我已经被这个问题困扰了很长时间。我正在尝试检查提到的用户是否是机器人。我用过

message.mentions.members.first();

检查存储在变量profileMentionned

中的提及项
let profileMentionned = message.mentions.members.first();

作为提到的配置文件参数。但是当我试图把

profileMentionned.bot

在 if 语句中,它永远不会输出 boolean 值,它不会测试用户是否是机器人,只会作为我设置的默认值出现 var这是 "undefined".

这是我的来源:

case "profile":
    var isAdmin = "undefined";
    let profileMentionned = message.mentions.members.first();
    if (!profileMentionned) return message.channel.send("Error message about mentionning a user")
    if (profileMentionned.hasPermission("MANAGE_MESSAGES"))
    {
        isAdmin = "Admin boi";
    } else {
        isAdmin = "Member pleb";
    //Now here's the problem part
    if (profileMentionned.bot) isAdmin = "Bot";
    //I also tried with "if (profileMentionned === true) isAdmin = "Bot";"
break;

感谢您的回答! <3 :)

用户有机器人标记,会员没有。
你需要做 profileMentionned.user.bot.
查看文档 here.