DiscordJS角色集返回API错误:缺少权限

DiscordJS角色集返回API错误:缺少权限,discord,Discord,我试图设置成员角色,但它没有设置权限 我的index.js文件: var u, s, m; await bot.users.fetch(message.author.id) .then(user => { u = user; }); await bot.guilds.fetch('419248578121433100') .then(guild => { s =

我试图设置成员角色,但它没有设置权限

我的index.js文件:

    var u, s, m;

    await bot.users.fetch(message.author.id)
                        .then(user => { u = user; });
    await bot.guilds.fetch('419248578121433100')
                        .then(guild => { s = guild; });
    await s.members.fetch(u)
                        .then(member => { m = member; });

    axios.get('/process')
    .then(function (response)
    {
        var dptos = response.data.dptos;
        var attrs = response.data.userAttrs;
        var roles = response.data.roles;

        if(dptos.length > 0) m.setNickname(dptos[0].position + ' | ' + attrs.name + ' ' + attrs.surname);
        else m.setNickname(attrs.name + ' ' + attrs.surname + ' | ' + '123456');

        m.roles.set(roles)
        .then(function(member)
        {
            let fd = fs.openSync('log.txt', 'w');
            fs.writeSync(fd, JSON.stringify(member.roles.cache));
            fs.closeSync(fd);

        })
        .catch(function(error)
        {
            let fd = fs.openSync('error.txt', 'w');
            fs.writeSync(fd, error);
            fs.closeSync(fd);

        });

        return message.reply('Congrats!'); 
    })
    .catch(function (error)
    {
        return message.reply('error!'); 
    });
}
axios请求按预期工作,数据获得正确

截图:

更新1


有什么问题吗?

您能提供响应状态代码吗?如果您试图编辑具有“discord admin”角色的用户,那是因为机器人的位置不是1。不,我不是。我尝试为该角色指定的用户完全没有角色状态代码为200是否确定缺少的perm正在添加角色?这段代码还需要perms来设置昵称。