我收到以下错误:
C:\Users\(private)\discord\bots\(private)\node_modules\@discordjs\collection\dist\index.js:161
if (fn(val, key, this))
^
TypeError: fn is not a function
与错误相关的代码:
// This is in the discord.js module
find(fn, thisArg) {
if (typeof thisArg !== 'undefined')
fn = fn.bind(thisArg);
for (const [key, val] of this) {
if (fn(val, key, this))
return val;
}
return undefined;
}
还有我的代码,如果有帮助的话。出于测试目的,我已将其简化为一个简单的 console.log:
\\ not everything is here, just the important stuff.
const target = message.guild.members.cache.find(args[0])
console.log(target.roles.forEach(role => console.log(role.id)))