Improved the definition of structures' client properties

This commit is contained in:
Schuyler Cebulskie
2016-12-02 19:52:27 -05:00
parent edfb27f428
commit 2488e1a00f
15 changed files with 46 additions and 31 deletions

View File

@@ -5,10 +5,11 @@ class Channel {
constructor(client, data) {
/**
* The client that instantiated the Channel
* @name Channel#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
/**
* The type of the channel, either:

View File

@@ -8,10 +8,11 @@ class Emoji {
constructor(guild, data) {
/**
* The Client that instantiated this object
* @name Emoji#client
* @type {Client}
* @readonly
*/
this.client = guild.client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: guild.client });
/**
* The guild this emoji is part of

View File

@@ -17,10 +17,11 @@ class Guild {
constructor(client, data) {
/**
* The Client that created the instance of the the Guild.
* @name Guild#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
/**
* A collection of members that are in this guild. The key is the member's ID, the value is the member.

View File

@@ -13,10 +13,11 @@ class GuildMember {
constructor(guild, data) {
/**
* The Client that instantiated this GuildMember
* @name GuildMember#client
* @type {Client}
* @readonly
*/
this.client = guild.client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: guild.client });
/**
* The guild that this member is part of

View File

@@ -31,10 +31,11 @@ class Invite {
constructor(client, data) {
/**
* The client that instantiated the invite
* @name Invite#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
this.setup(data);
}

View File

@@ -12,10 +12,11 @@ class Message {
constructor(channel, data, client) {
/**
* The Client that instantiated the Message
* @name Message#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
/**
* The channel that the message was sent in

View File

@@ -5,10 +5,11 @@ class MessageAttachment {
constructor(message, data) {
/**
* The Client that instantiated this MessageAttachment.
* @name MessageAttachment#client
* @type {Client}
* @readonly
*/
this.client = message.client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: message.client });
/**
* The message this attachment is part of.

View File

@@ -5,10 +5,11 @@ class MessageEmbed {
constructor(message, data) {
/**
* The client that instantiated this embed
* @name MessageEmbed#client
* @type {Client}
* @readonly
*/
this.client = message.client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: message.client });
/**
* The message this embed is part of

View File

@@ -5,10 +5,11 @@ class OAuth2Application {
constructor(client, data) {
/**
* The client that instantiated the application
* @name OAuth2Application#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
this.setup(data);
}

View File

@@ -12,10 +12,11 @@ class PartialGuild {
constructor(client, data) {
/**
* The Client that instantiated this PartialGuild
* @name PartialGuild#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
this.setup(data);
}

View File

@@ -11,10 +11,11 @@ class PartialGuildChannel {
constructor(client, data) {
/**
* The Client that instantiated this PartialGuildChannel
* @name PartialGuildChannel#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
this.setup(data);
}

View File

@@ -7,10 +7,11 @@ class Role {
constructor(guild, data) {
/**
* The client that instantiated the role
* @name Role#client
* @type {Client}
* @readonly
*/
this.client = guild.client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: guild.client });
/**
* The guild that the role belongs to

View File

@@ -10,10 +10,11 @@ class User {
constructor(client, data) {
/**
* The Client that created the instance of the the User.
* @name User#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
if (data) this.setup(data);
}

View File

@@ -14,10 +14,11 @@ class UserProfile {
/**
* The Client that created the instance of the the UserProfile.
* @name UserProfile#client
* @type {Client}
* @readonly
*/
this.client = this.user.client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: user.client });
/**
* Guilds that the client user and the user share

View File

@@ -9,15 +9,16 @@ class Webhook {
if (client) {
/**
* The Client that instantiated the Webhook
* @name Webhook#client
* @type {Client}
* @readonly
*/
this.client = client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
Object.defineProperty(this, 'client', { value: client });
if (dataOrID) this.setup(dataOrID);
} else {
this.id = dataOrID;
this.token = token;
this.client = this;
Object.defineProperty(this, 'client', { value: this });
}
}