Discord.js 我提到唐';不工作,只发送未定义的

Discord.js 我提到唐';不工作,只发送未定义的,discord.js,Discord.js,如何标记某人,在频道上发送消息“Hello xd undefined”。请帮助我 根据,将始终返回一个。这意味着您的if语句总是返回false,因为message.indications.users确实是在未提及任何用户时定义的 与其检查message.notices.users是否错误,不如检查集合中是否有任何元素 if(message.notices.users.size==0)返回;//或者返回您的错误消息。 显然,discord.js将用户对象解释为提及。你应该有这个: message.

如何标记某人,在频道上发送消息“Hello xd undefined”。请帮助我

根据,将始终返回一个。这意味着您的
if
语句总是返回false,因为
message.indications.users确实是在未提及任何用户时定义的

与其检查
message.notices.users
是否错误,不如检查集合中是否有任何元素

if(message.notices.users.size==0)返回;//或者返回您的错误消息。

显然,discord.js将用户对象解释为提及。你应该有这个:

message.author.toString()
而不是:

message.mentions.users.first()
我希望我帮了忙:)

参考资料:

尝试
message.indications.members.first().displayName
message.indications.users.first().displayName
而不是
message.indications.users.first()

您是否尝试将
message.indications.users
记录到控制台?否,如何?bumppp
console.log(message.indications.users)
console-log:Collection{}如果我使用!如果我使用命令,那就是工作!命令,即发送“Hello xd undefined”。
message.mentions.users.first()