Organise structure methods

This commit is contained in:
Schuyler Cebulskie
2016-09-07 02:07:39 -04:00
parent 73cb34ed37
commit 818649b94f
13 changed files with 493 additions and 577 deletions

View File

@@ -3,17 +3,19 @@
*/
class MessageEmbed {
constructor(message, data) {
/**
* The message this embed is part of
* @type {Message}
*/
this.message = message;
/**
* The client that instantiated this embed
* @type {Client}
*/
this.client = message.client;
Object.defineProperty(this, 'client', { enumerable: false, configurable: false });
/**
* The message this embed is part of
* @type {Message}
*/
this.message = message;
this.setup(data);
}
@@ -23,42 +25,42 @@ class MessageEmbed {
* @type {?string}
*/
this.title = data.title;
/**
* The type of this embed
* @type {string}
*/
this.type = data.type;
/**
* The description of this embed, if there is one
* @type {?string}
*/
this.description = data.description;
/**
* The URL of this embed
* @type {string}
*/
this.url = data.url;
if (data.thumbnail) {
/**
* The thumbnail of this embed, if there is one
* @type {MessageEmbedThumbnail}
*/
this.thumbnail = new MessageEmbedThumbnail(this, data.thumbnail);
}
if (data.author) {
/**
* The author of this embed, if there is one
* @type {MessageEmbedAuthor}
*/
this.author = new MessageEmbedAuthor(this, data.author);
}
if (data.provider) {
/**
* The provider of this embed, if there is one
* @type {MessageEmbedProvider}
*/
this.provider = new MessageEmbedProvider(this, data.provider);
}
/**
* The thumbnail of this embed, if there is one
* @type {MessageEmbedThumbnail}
*/
this.thumbnail = data.thumbnail ? new MessageEmbedThumbnail(this, data.thumbnail) : null;
/**
* The author of this embed, if there is one
* @type {MessageEmbedAuthor}
*/
this.author = data.author ? new MessageEmbedAuthor(this, data.author) : null;
/**
* The provider of this embed, if there is one
* @type {MessageEmbedProvider}
*/
this.provider = data.provider ? new MessageEmbedProvider(this, data.provider) : null;
}
}
@@ -72,6 +74,7 @@ class MessageEmbedThumbnail {
* @type {MessageEmbed}
*/
this.embed = embed;
this.setup(data);
}
@@ -81,16 +84,19 @@ class MessageEmbedThumbnail {
* @type {string}
*/
this.url = data.url;
/**
* The Proxy URL for this thumbnail
* @type {string}
*/
this.proxyURL = data.proxy_url;
/**
* The height of the thumbnail
* @type {number}
*/
this.height = data.height;
/**
* The width of the thumbnail
* @type {number}
@@ -109,6 +115,7 @@ class MessageEmbedProvider {
* @type {MessageEmbed}
*/
this.embed = embed;
this.setup(data);
}
@@ -118,6 +125,7 @@ class MessageEmbedProvider {
* @type {string}
*/
this.name = data.name;
/**
* The URL of this provider
* @type {string}
@@ -136,6 +144,7 @@ class MessageEmbedAuthor {
* @type {MessageEmbed}
*/
this.embed = embed;
this.setup(data);
}
@@ -145,6 +154,7 @@ class MessageEmbedAuthor {
* @type {string}
*/
this.name = data.name;
/**
* The URL of this author
* @type {string}