So I'm trying to set nicknames to people with the bot, however it errors out as Missing Permissions
C:\Users\EntropicBlackhole\Dropbox\PC\Desktop\Bot\node_modules\discord.js\src\rest\RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Permissions
at RequestHandler.execute (C:\Users\EntropicBlackhole\Dropbox\PC\Desktop\Bot\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\EntropicBlackhole\Dropbox\PC\Desktop\Bot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async GuildMemberManager.edit (C:\Users\EntropicBlackhole\Dropbox\PC\Desktop\Bot\node_modules\discord.js\src\managers\GuildMemberManager.js:279:15) {
method: 'patch',
path: '/guilds/758349837657440256/members/708026434660204625',
code: 50013,
httpStatus: 403,
requestData: {
json: { nick: 'nickname', communication_disabled_until: undefined },
files: []
}
}
Why do I get this error? The bot has administrator permissions but I don't really understand why it gives this error
ADMINISTRATOR permission to change the nickname of the other person isn't enough, instead you should give the bot MANAGE_NICKNAMES and CHANGE_NICKNAME permissions, but if you want to restrict others from accessing your command, add this:
if(!<User>.permissions.has(Permissions.FLAGS.MANAGE_NICKNAMES && Permissions.FLAGS.CHANGE_NICKNAME)) return message.reply({ content: `you dont have enough permission to use this command` })
For more information about Discord Permissions: Discord Permissions