mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
Improved the definition of structures' client properties
This commit is contained in:
@@ -5,10 +5,11 @@ class Channel {
|
|||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The client that instantiated the Channel
|
* The client that instantiated the Channel
|
||||||
|
* @name Channel#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the channel, either:
|
* The type of the channel, either:
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ class Emoji {
|
|||||||
constructor(guild, data) {
|
constructor(guild, data) {
|
||||||
/**
|
/**
|
||||||
* The Client that instantiated this object
|
* The Client that instantiated this object
|
||||||
|
* @name Emoji#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = guild.client;
|
Object.defineProperty(this, 'client', { value: guild.client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The guild this emoji is part of
|
* The guild this emoji is part of
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ class Guild {
|
|||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The Client that created the instance of the the Guild.
|
* The Client that created the instance of the the Guild.
|
||||||
|
* @name Guild#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of members that are in this guild. The key is the member's ID, the value is the member.
|
* A collection of members that are in this guild. The key is the member's ID, the value is the member.
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ class GuildMember {
|
|||||||
constructor(guild, data) {
|
constructor(guild, data) {
|
||||||
/**
|
/**
|
||||||
* The Client that instantiated this GuildMember
|
* The Client that instantiated this GuildMember
|
||||||
|
* @name GuildMember#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = guild.client;
|
Object.defineProperty(this, 'client', { value: guild.client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The guild that this member is part of
|
* The guild that this member is part of
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ class Invite {
|
|||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The client that instantiated the invite
|
* The client that instantiated the invite
|
||||||
|
* @name Invite#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
this.setup(data);
|
this.setup(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ class Message {
|
|||||||
constructor(channel, data, client) {
|
constructor(channel, data, client) {
|
||||||
/**
|
/**
|
||||||
* The Client that instantiated the Message
|
* The Client that instantiated the Message
|
||||||
|
* @name Message#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The channel that the message was sent in
|
* The channel that the message was sent in
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ class MessageAttachment {
|
|||||||
constructor(message, data) {
|
constructor(message, data) {
|
||||||
/**
|
/**
|
||||||
* The Client that instantiated this MessageAttachment.
|
* The Client that instantiated this MessageAttachment.
|
||||||
|
* @name MessageAttachment#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = message.client;
|
Object.defineProperty(this, 'client', { value: message.client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The message this attachment is part of.
|
* The message this attachment is part of.
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ class MessageEmbed {
|
|||||||
constructor(message, data) {
|
constructor(message, data) {
|
||||||
/**
|
/**
|
||||||
* The client that instantiated this embed
|
* The client that instantiated this embed
|
||||||
|
* @name MessageEmbed#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = message.client;
|
Object.defineProperty(this, 'client', { value: message.client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The message this embed is part of
|
* The message this embed is part of
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ class OAuth2Application {
|
|||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The client that instantiated the application
|
* The client that instantiated the application
|
||||||
|
* @name OAuth2Application#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
this.setup(data);
|
this.setup(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ class PartialGuild {
|
|||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The Client that instantiated this PartialGuild
|
* The Client that instantiated this PartialGuild
|
||||||
|
* @name PartialGuild#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
this.setup(data);
|
this.setup(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,11 @@ class PartialGuildChannel {
|
|||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The Client that instantiated this PartialGuildChannel
|
* The Client that instantiated this PartialGuildChannel
|
||||||
|
* @name PartialGuildChannel#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
this.setup(data);
|
this.setup(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ class Role {
|
|||||||
constructor(guild, data) {
|
constructor(guild, data) {
|
||||||
/**
|
/**
|
||||||
* The client that instantiated the role
|
* The client that instantiated the role
|
||||||
|
* @name Role#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = guild.client;
|
Object.defineProperty(this, 'client', { value: guild.client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The guild that the role belongs to
|
* The guild that the role belongs to
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ class User {
|
|||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The Client that created the instance of the the User.
|
* The Client that created the instance of the the User.
|
||||||
|
* @name User#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
if (data) this.setup(data);
|
if (data) this.setup(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ class UserProfile {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The Client that created the instance of the the UserProfile.
|
* The Client that created the instance of the the UserProfile.
|
||||||
|
* @name UserProfile#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = this.user.client;
|
Object.defineProperty(this, 'client', { value: user.client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guilds that the client user and the user share
|
* Guilds that the client user and the user share
|
||||||
|
|||||||
@@ -9,15 +9,16 @@ class Webhook {
|
|||||||
if (client) {
|
if (client) {
|
||||||
/**
|
/**
|
||||||
* The Client that instantiated the Webhook
|
* The Client that instantiated the Webhook
|
||||||
|
* @name Webhook#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.client = client;
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
|
|
||||||
if (dataOrID) this.setup(dataOrID);
|
if (dataOrID) this.setup(dataOrID);
|
||||||
} else {
|
} else {
|
||||||
this.id = dataOrID;
|
this.id = dataOrID;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.client = this;
|
Object.defineProperty(this, 'client', { value: this });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user