msg.guild.roles.find不是一个函数 由 类敏思发布于 2020-05-09 21:50:33 我真的不知道为什么会导致这个问题,为了使我的discord.js保持最新 TypeError: msg.guild.roles.find is not a function
Since discord.js v12 accessing the
roles
collection can be done through thecache
property.msg.guild.roles.cache.find()
If you have got discord.js version 12, you can use @Syntle solution, or there is also
msg.guild.roles.fetch(id,[cache])
. I think, that this is better, because the role dont have to be cached.上面的错误是由于Discord.js库中没有'find'方法引起的。
Discord.js改为使用“提取”方法。可以使用以下命令调用它:
更多信息:
https://discord.js.org/#/docs/main/master/class/RoleManager