I am trying to make a Discord bot and I want to make a !nick command and I keep getting the same error, could someone help me:
ERROR:
{ DiscordAPIError: Missing Permissions
at item.request.gen.end (/rbd/pnpm-volume/76d7cd6d-9602-4908-bb55-ccc4f8de8537/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:79:15)
at then (/rbd/pnpm-volume/76d7cd6d-9602-4908-bb55-ccc4f8de8537/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
name: 'DiscordAPIError',
message: 'Missing Permissions',
path: '/api/v7/guilds/485921672013283339/members/469227202345697280',
code: 50013,
method: 'PATCH' }
const Discord = require("discord.js");
exports.run = (client, message, args, member) => {
const arg = args.join(" ")
if (arg === null || arg === "" || arg === undefined || arg == " ") {
var embed = new Discord.RichEmbed()
embed.setColor(0x00AE86);
embed.addField("USAGE", "!nick (nickname)", false);
message.channel.send(embed);
}
else {
var embed = new Discord.RichEmbed()
embed.setColor(0x00AE86);
embed.addField("NICKNAME", "You have set your nickname to **" + arg + "**", false);
message.channel.send(embed);
message.member.setNickname("["+ member.highestRole.name + "]" + member.displayName)
.then(console.log)
.catch(console.error);
}
}
Does anyone know why I am getting this error, if so please tell me HOW to fix it. Thank you!