User-info Command

There are a few things wrong with this code. First of all, returns a User, which does not have a nickname. Since nicknames can be modified per server, you’re looking for a GuildMember.

Also, GuildMember.nickname will return undefined if the GuildMember doesn’t actually have a nickname. There are a few ways you can fix it. You can either use GuildMember.displayName, which will try to display the nickname but will display the username if none is found, or you could simply handle it with the logical OR operator ||

// method 1:
.addField('Nickname',, true)

// method 2:
.addField('Nickname', || 'This user has no nickname', true)

Speaking of GuildMembers and Users, you are using a very overcomplicated way to get the GuildMember instance of the author at this line:


There’s actually an easier way to use this: Message.member. It’s the same thing as, but returns a GuildMember. Also, I’m not sure why you’re using the _roles getter instead of the much more efficient roles.

You have the same problems with, as permissions are modified per guild and do not have one global value. Even then, it’s going to return [object Object]. And even if it didn’t, it would probably return a bitfield representation which would not be legable by the average discord user.

Instead, you should use the Permissions.toArray() method, which will return an array of bitfield names based on the bits available (all of the member’s permissions). It might look a bit like this:


You can use Array.prototype.join() to join these elements by a line break, or a comma and space, etc.

Also, you shouldn’t be using template literals unless you want to add a variable to a string with other characters/template literals, or you need to coerce the variable’s data type to string. for example, is already a string, so:

- `${}`

Presence.status is returning ‘offline’ because you don’t have the GUILD_PRESENCES intent enabled

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top