How can I get user’s guild nickname from a slash command?

displayName doesn’t return a user’s server nickname, and ’user’ in a slash command doesn’t include nickname property. How should one get the nickname efficently?
2 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs9mo ago
:property: GuildMember#nickname The nickname of this member, if they have one :property: ChatInputCommandInteraction#member If this interaction was sent in a guild, the member which sent it Despite sounding similar there is a distinct difference between users and members in Discord: - User: global Discord user data (global avatar, username, tag, id) - GuildMember: user data associated to a guild (guild, nickname, roles, voice, guild avatar, etc.) - Conversion: User ➞ GuildMember | GuildMember ➞ User * Note: Events received in cached guilds will often have both the member and user available, eg. interaction.user and interaction.member
Want results from more Discord servers?
Add your server