[英]fn.bind is not a function
I keep getting fh bind errors, I keep getting errors as I'm trying to assign roles on join with discord我不断收到 fh 绑定错误,在尝试使用 discord 分配角色时,我不断收到错误
client.on('guildMemberAdd', role => {
console.log('user' + role.username + ' joined the battle!');
var role = role.guild.roles.cache.find('name', 'member' )
role.addrole(role)
});
This is because you are using role.guild.roles.cache.find
incorrectly.这是因为您错误地使用
role.guild.roles.cache.find
。 According to the manual , this function works similar to Array.find
in JavaScript .根据手册,这个 function 的工作原理类似于
Array.find
中的 Array.find 。
The method takes a function that is supposed to return true
for elements in the cache matching your search criteria, for example:该方法采用 function 应该为缓存中匹配您的搜索条件的元素返回
true
,例如:
var role = role.guild.roles.cache.find(r => r.name === 'member');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.