Javascript 如何检查是否找到提及的成员?

Javascript 如何检查是否找到提及的成员?,javascript,discord,discord.js,Javascript,Discord,Discord.js,如何检查提及是否为提及 if (msg.content.toLowerCase().startsWith('!find')) { target = msg.mentions.members.first() if (!target) return msg.channel.send(`Member not found!`) msg.channel.send('Found!') } 这是我的代码,我想检查是否找到了提到的内容,因为(!target)仅适用于空结果。我自己修复了

如何检查提及是否为提及

if (msg.content.toLowerCase().startsWith('!find')) {
    target = msg.mentions.members.first()
    if (!target) return msg.channel.send(`Member not found!`)
    msg.channel.send('Found!')
}

这是我的代码,我想检查是否找到了提到的内容,因为(!target)仅适用于空结果。

我自己修复了代码

代码是

if(msg.content.toLowerCase().startsWith(“!find”)){
target=msg.indications.members.first()
如果(!target)返回msg.channel.send(`Member not found!`)
msg.channel.send('Found!')

}
我们无法访问这些值。把它们寄出去。什么是
console.log(msg.content,target)
?什么值?我这里没有
console.log(msg.content,target)
,但您有
msg.content
target
作为变量。我们无法猜测值,这是违反逻辑的,逻辑就是编程。它的价值是什么?Read msg.content与message.content相同,target等于msg.indications.members.first()!找到