discord.js/src/structures/MessageEmbed.js
Programmix fe3914658a Grammar cleanup (#875)
This commit:
* fixes inconsistencies (primarily regarding capitalization)
* fixes non-proper nouns that were improperly capitalized
* fixes reminents from not-so-meticulous copy+paste jobs
2016-11-05 23:57:34 +00:00

170 lines
3.2 KiB
JavaScript

/**
* Represents an embed in an image - e.g. preview of image
*/
class MessageEmbed {
constructor(message, data) {
/**
* 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);
}
setup(data) {
/**
* The title of this embed, if there is one
* @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;
/**
* 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;
}
}
/**
* Represents a thumbnail for a message embed
*/
class MessageEmbedThumbnail {
constructor(embed, data) {
/**
* The embed this thumbnail is part of
* @type {MessageEmbed}
*/
this.embed = embed;
this.setup(data);
}
setup(data) {
/**
* The URL for this thumbnail
* @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}
*/
this.width = data.width;
}
}
/**
* Represents a provider for a message embed
*/
class MessageEmbedProvider {
constructor(embed, data) {
/**
* The embed this provider is part of
* @type {MessageEmbed}
*/
this.embed = embed;
this.setup(data);
}
setup(data) {
/**
* The name of this provider
* @type {string}
*/
this.name = data.name;
/**
* The URL of this provider
* @type {string}
*/
this.url = data.url;
}
}
/**
* Represents a author for a message embed
*/
class MessageEmbedAuthor {
constructor(embed, data) {
/**
* The embed this author is part of
* @type {MessageEmbed}
*/
this.embed = embed;
this.setup(data);
}
setup(data) {
/**
* The name of this author
* @type {string}
*/
this.name = data.name;
/**
* The URL of this author
* @type {string}
*/
this.url = data.url;
}
}
MessageEmbed.Thumbnail = MessageEmbedThumbnail;
MessageEmbed.Provider = MessageEmbedProvider;
MessageEmbed.Author = MessageEmbedAuthor;
module.exports = MessageEmbed;