I want to create a Change Nickname command in discord.js v13, and It's not working. My code:
const target = message.mentions.members.first();
const nickname = args.slice(1).join(' ');
if (!target) return message.channel.send('Please specify a target to change nickname');
if (!nickname) return message.channel.send('Please specify a nickname to change');
target.setNickname(nickname);
I am using node.js v16
Your code is working for me, but make sure your bot has the following Permissions and the bot's role is above the role of the users who want to edit his nick: Change this: https://i.sstatic.net/lKP9h.png To this: https://i.sstatic.net/xX8GF.png Also make sure your command is lowercase because uppercase characters are not allowed in command names.