displayName will return the nickname if set in the guild (server), or the username If there is no nickname in the guild (server).
module.exports = {
name: 'ping',
execute(client, msg, args) {
msg.reply(`Hello ${msg.member.displayName}`)
}
}
How can i get nickname of user from User Profile? not guild (server).
2
Answers
I’m assuming you are referring to the global display name (The Display Name set in Account Settings), which can be accessed like this:
See:
Message.author
User.displayName
User object (Discord’s documentation about users, this explains which field is what a bit better)
You can get global display name with this code:
the
msg.member.user.globalName
will get Display Name of user from User Profile (Account Settings)