简体   繁体   English

fn.bind 不是 function

[英]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.

相关问题 Vue Uncaught TypeError:fn.bind不是函数 - Vue Uncaught TypeError: fn.bind is not a function 类型错误:fn.bind 不是 Discord.js 公会成员更新事件的函数 - TypeError: fn.bind is not a function with Discord.js Guild Member Update Event 类型错误:fn.bind 不是 function。 Discord.js v13 - TypeError: fn.bind is not a function. Discord.js v13 discord.js 的 fn.bind 错误代码是什么? - What is the fn.bind Error code for discord.js? jQuery内部问题,fn.bind / fn.apply应用于可拖动对象(试图做更好的异常处理) - Problems with jQuery internals, fn.bind/fn.apply on draggables (trying to do better exception handling) 如果我们在JavaScript中填充fn.bind(),为什么还要检查“this”的类型? - If we polyfill fn.bind() in JavaScript, why do you have to check the type of “this”? 为什么调用 Function.apply.bind(fn, null) 调用的是 `fn.apply`,而不是 `Function.apply`? - Why call to Function.apply.bind(fn, null) calls `fn.apply`, and not `Function.apply`? jQuery:$()。click(fn)vs. $()。bind('click',fn); - jQuery: $().click(fn) vs. $().bind('click',fn); 量角器:TypeError:fn不是函数 - Protractor: TypeError: fn is not a function AngularJS:fn不是函数 - AngularJS: fn is not a function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM