【发布时间】:2021-03-04 22:36:48
【问题描述】:
不知道为什么它不起作用,有人可以帮助我吗?我绝望了。
bot.on("message", (message) => {
var roles = message.author.roles
let roleID = '1234567890';
if (message.author.bot) return;
if(message.content.startsWith(prefix + 'ttt')) {
roles.add(roleID);
}
});
The Error is the same like in the title.
roles.add(roleID);
^
TypeError: Cannot read property 'add' of undefined
【问题讨论】:
-
我明白了!谢谢!
-
您好酋长国,请告诉我们您是如何解决问题的。您的解决方案可以帮助具有相同行为的其他人。
标签: javascript node.js discord discord.js