简体   繁体   English

message.mentions.users.first() 未定义 - discord.js

[英]message.mentions.users.first() not defined - discord.js

const user = message.mentions.users.first();
console.log(user)

This is just a snippet of code, but the console outputs undefined.这只是一段代码,但控制台输出未定义。 Above this is boilerplate command handler stuff.上面是样板命令处理程序的东西。 Other things work fine, but the message.mentions.users.first is the problem.其他工作正常,但 message.mentions.users.first 是问题所在。 I've tried almost everything from other questions like this.我已经尝试了其他类似问题的几乎所有内容。 Any ideas?有任何想法吗?

Reginald is the role not a user that's why message.mentions gives you 'mentionable:false' check if there is role same name as 'Reginald' Reginald 是role而不是user ,这就是为什么 message.mentions 为您提供“mentionable:false”检查是否有与“Reginald”同名的角色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM