mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
Clean up a bunch of stuff
- Channel typing data is now a Map - Client properties on structures are now non-enumerable and non-configurable
This commit is contained in:
@@ -7,36 +7,47 @@ const Constants = require('../util/Constants');
|
||||
*/
|
||||
class User {
|
||||
constructor(client, data) {
|
||||
/**
|
||||
* The Client that created the instance of the the User.
|
||||
* @type {Client}
|
||||
*/
|
||||
this.client = client;
|
||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
||||
|
||||
if (data) this.setup(data);
|
||||
}
|
||||
|
||||
setup(data) {
|
||||
/**
|
||||
* The username of the User
|
||||
* @type {string}
|
||||
*/
|
||||
this.username = data.username;
|
||||
/**
|
||||
* The ID of the User
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* The username of the User
|
||||
* @type {string}
|
||||
*/
|
||||
this.username = data.username;
|
||||
|
||||
/**
|
||||
* A discriminator based on username for the User
|
||||
* @type {string}
|
||||
*/
|
||||
this.discriminator = data.discriminator;
|
||||
|
||||
/**
|
||||
* The ID of the user's avatar
|
||||
* @type {string}
|
||||
*/
|
||||
this.avatar = data.avatar;
|
||||
|
||||
/**
|
||||
* Whether or not the User is a Bot.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.bot = Boolean(data.bot);
|
||||
|
||||
/**
|
||||
* The status of the user:
|
||||
*
|
||||
@@ -46,6 +57,7 @@ class User {
|
||||
* @type {string}
|
||||
*/
|
||||
this.status = data.status || this.status || 'offline';
|
||||
|
||||
/**
|
||||
* The game that the user is playing, `null` if they aren't playing a game.
|
||||
* @type {string}
|
||||
@@ -99,8 +111,8 @@ class User {
|
||||
*/
|
||||
equals(user) {
|
||||
let equal = user &&
|
||||
this.username === user.username &&
|
||||
this.id === user.id &&
|
||||
this.username === user.username &&
|
||||
this.discriminator === user.discriminator &&
|
||||
this.avatar === user.avatar &&
|
||||
this.bot === Boolean(user.bot);
|
||||
|
||||
Reference in New Issue
Block a user