I wonder if you can help (I search it and nothing...) I am learning how to work with discord.js node and I want to change my user nickname (not the username itself)
My code is
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log('I am ready!');
});
client.on('message', message => {
if (message.content.includes('changeNick')) {
client.setNickname({nick: message.content.replace('changeNick ', '')});
}
});
client.login('token');
According to the Docs, You can only change a guild members nickname, so you need to get the member object of your client from its id, and set the nickname of it as shown in the docs, Like this:
Note that this will not work always, your client will need to have
changeNickname
or it won't work