Reputation: 25
I'm trying to my update my discord bot to discord.js v12.
dc
is a logged in discord bot client
dc.users.fetch(id, false).then(user => {
console.log(user);
}
I get the following output:
User {
id: 'myId',
username: 'myUsername',
bot: false,
discriminator: 'someNumber',
avatar: 'stuff',
flags: UserFlags { bitfield: 0 },
lastMessageID: null,
lastMessageChannelID: null
}
Where are all the properties a user object should normally contain?
user.dmChannel
for example
Upvotes: 1
Views: 213
Reputation: 3005
These properties (user.tag
, user.guild
, etc.) are getters. It means that they are calculated using other variables in the object. For example, tag
is not a property of the user
class, it's just a function that returns a string:
get tag () {
return `${this.username}#${this.discriminator}`;
}
It is better, because if the username changes, the tag will automatically be updated. You can't see all the getters of the user using console.log(user);
, you should use the documentation instead.
Upvotes: 1