Missing Permissions

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'
}
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'
}
9 Replies
d.js toolkit
d.js toolkit13mo ago
• 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.
布鲁诺 普雷托

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)
}

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)
}
axiprime
axiprime13mo ago
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.
布鲁诺 普雷托
yeah thats it lol I just used a dummy discord account and it worked
axiprime
axiprime13mo ago
you can also guild.members.cache.get(userId)
布鲁诺 普雷托
thanks
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
布鲁诺 普雷托
instead of havin it above I have it down