msg.guild.roles.find不是一个函数 由 类敏思发布于 2020-05-09 21:50:33 javascriptdiscord.js 收藏 我真的不知道为什么会导致这个问题,为了使我的discord.js保持最新 TypeError: msg.guild.roles.find is not a function 评论 请 登录后发表观点 Dicke 2020-05-09 21:50:34 Since discord.js v12 accessing the roles collection can be done through the cache property. msg.guild.roles.cache.find() 点赞 评论 莫~大宝 2020-05-09 21:50:34 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. 点赞 评论 弭希彤 2020-05-09 21:50:34 上面的错误是由于Discord.js库中没有'find'方法引起的。 Discord.js改为使用“提取”方法。可以使用以下命令调用它: message.guild.roles.fetch() 更多信息: https://discord.js.org/#/docs/main/master/class/RoleManager 点赞 评论 到底啦
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