#Missing Permissions

12 messages · Page 1 of 1 (latest)

quiet hornet
#
Error occurred while changing the nickname: DiscordAPIError[50013]: Missing Permissions
    at SequentialHandler.runRequest (/home/brunommpreto/WebstormProjects/OPP/node_modules/@discordjs/rest/dist/index.js:667:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.queueRequest (/home/brunommpreto/WebstormProjects/OPP/node_modules/@discordjs/rest/dist/index.js:464:14)
    at async REST.request (/home/brunommpreto/WebstormProjects/OPP/node_modules/@discordjs/rest/dist/index.js:910:22)
    at async GuildMemberManager.edit (/home/brunommpreto/WebstormProjects/OPP/node_modules/discord.js/src/managers/GuildMemberManager.js:325:15)
    at async Client.<anonymous> (/home/brunommpreto/WebstormProjects/OPP/index.js:127:7) {
  requestBody: { files: undefined, json: { nick: 'asdasdasdddddddddddddddd' } },
  rawError: { message: 'Missing Permissions', code: 50013 },
  code: 50013,
  status: 403,
  method: 'PATCH',
  url: 'https://discord.com/api/v10/guilds/1029087556119314482/members/432864216647598100'
}


subtle muralBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

quiet hornet
#
 
           try {
                    const member = client.guilds.cache.get(OPP).members.fetch(interaction.user.id);
                    if (!member) return console.log('Member not found.');
                    try {
                        //await (await member).setNickname(nicknameingame);
                        await (await member).edit({nick: nicknameingame.toString()})
                        console.log(`Nickname changed to "${nicknameingame}" for ${member.user.tag}`);
                    } catch (error) {
                        console.error('Error occurred while changing the nickname:', error);
                    }
                    const role = client.guilds.cache.get(OPP).roles.cache.get('1108323371000811560');
                    //await member.roles.remove(role);
                }catch (error){
                    console.error(error)
                }
upbeat remnant
#

I believe bot can't change server owner nickname.

#

that might be your issue.

#

also, in your const member, fetch is async so add await.

quiet hornet
#

I just used a dummy discord account and it worked

upbeat remnant
#

you can also guild.members.cache.get(userId)

quiet hornet
#

thanks

abstract flare
#

await (await member).edit

that just confuses me