[英]TypeError: Cannot read property 'add' of undefined discord.js
So i have a discord bot, and i have been forking some code and basically experminting. 所以我有一个不和谐的机器人,并且我一直在分叉一些代码并基本上在开发。 my synax is right however it says TypeError: Cannot read property 'add' of undefined when i try to make my discord.js bot add a role.
我的synax是正确的,但是它显示TypeError:当我尝试使discord.js机器人添加角色时,无法读取未定义的属性“ add”。
client.guilds.get(config.guild).member(message.author).role.add(config.role) // ensure this is a string in the config ("")
.then(console.log(`TOKEN: ${message.author.token} :: Role ${config.role} added to member ${message.author.id}`))
.catch(console.error)
})
Could someone please explain how to fix this as i am still noobish at this. 有人可以解释一下如何解决此问题,因为我对此仍然持怀疑态度。
找出问题所在,由于某些原因,角色ID无效,执行\\@role
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.