From c5f93eb44ee5c3ae50085da4739cbf7227e649fa Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Fri, 9 Dec 2016 21:07:34 -0600 Subject: [PATCH] Add more MessageEmbed stuff (#970) * this is why wrapping data 1:1 is a bad idea * ffs * whoever wrote role.hexColor is a bad, bad person * Update MessageEmbed.js * Update MessageEmbed.js --- src/structures/MessageEmbed.js | 37 +++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 9dd0a9a0f..1249c422b 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -21,18 +21,18 @@ class MessageEmbed { } 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 title of this embed, if there is one + * @type {?string} + */ + this.title = data.title; + /** * The description of this embed, if there is one * @type {?string} @@ -45,6 +45,12 @@ class MessageEmbed { */ this.url = data.url; + /** + * The color of the embed + * @type {number} + */ + this.color = data.color; + /** * The fields of this embed * @type {MessageEmbedField[]} @@ -90,6 +96,17 @@ class MessageEmbed { get createdAt() { return new Date(this.createdTimestamp); } + + /** + * The hexadecimal version of the embed color, with a leading hash. + * @type {string} + * @readonly + */ + get hexColor() { + let col = this.color.toString(16); + while (col.length < 6) col = `0${col}`; + return `#${col}`; + } } /** @@ -188,6 +205,12 @@ class MessageEmbedAuthor { * @type {string} */ this.url = data.url; + + /** + * The icon URL of this author + * @type {string} + */ + this.iconURL = data.icon_url; } } @@ -251,7 +274,7 @@ class MessageEmbedFooter { * The icon URL of this footer * @type {string} */ - this.iconUrl = data.icon_url; + this.iconURL = data.icon_url; /** * The proxy icon URL of this footer