所以我正在尝试让我的不和谐机器人为执行该任务的人添加角色,而我似乎无法使其正常工作 这是代码:
guild.members.fetch(message.author)
.then(member => {
member.roles.set(['roleID']);
});
这是我得到的错误:
(节点:5692)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“ set”
在D:\ Documents \ GitHub \ InfinitBotPrototip \ index.js:48:24
在processTicksAndRejections(内部/流程/task_queues.js:97:5)
(节点:5692)UnhandledPromiseRejectionWarning:未处理的承诺拒绝。引发此错误的原因可能是在没有catch块的情况下抛出了异步函数,或者是拒绝了promise w
hich未使用.catch()处理。要在未处理的承诺拒绝时终止节点进程,请使用CLI标志--unhandled-rejections=strict
(请参见https://nodejs.org/api/cli.html#cli_unhand
led_rejections_mode)。 (拒绝ID:1)
(节点:5692)[DEP0018] DeprecationWarning:已弃用未处理的承诺拒绝。将来,未处理的承诺拒绝将以非零e终止Node.js进程。
xit代码。