How to get the member's nickname in a guild? #599
-
Using A discord user, with James as username, but with Alison as nickname in the guild send the message : a code with : message.reply(` hello ${message.author.username}!` will result with : How to have the result : Using only ${message.author} works in this case, but in an embed message, it cause a bug, you have the member's id and not the nickname. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Nickname is guild bound data, as such available on the GuildMember instance.
|
Beta Was this translation helpful? Give feedback.
-
You can use |
Beta Was this translation helpful? Give feedback.
Nickname is guild bound data, as such available on the GuildMember instance.
The GuildMember for the message author can be accessed via
<Message>.member
..toString()
called on a User will yield the mention format<@id>
(template literals implicitly call.toString()
to display a value)..valueOf()
called on a User will yield its id (string) (any other concatenation implicitly calls.valueOf()
)