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
This commit is contained in:
Gus Caplan
2016-12-09 21:07:34 -06:00
committed by Schuyler Cebulskie
parent e51fed968d
commit c5f93eb44e

View File

@@ -21,18 +21,18 @@ class MessageEmbed {
} }
setup(data) { setup(data) {
/**
* The title of this embed, if there is one
* @type {?string}
*/
this.title = data.title;
/** /**
* The type of this embed * The type of this embed
* @type {string} * @type {string}
*/ */
this.type = data.type; 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 * The description of this embed, if there is one
* @type {?string} * @type {?string}
@@ -45,6 +45,12 @@ class MessageEmbed {
*/ */
this.url = data.url; this.url = data.url;
/**
* The color of the embed
* @type {number}
*/
this.color = data.color;
/** /**
* The fields of this embed * The fields of this embed
* @type {MessageEmbedField[]} * @type {MessageEmbedField[]}
@@ -90,6 +96,17 @@ class MessageEmbed {
get createdAt() { get createdAt() {
return new Date(this.createdTimestamp); 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} * @type {string}
*/ */
this.url = data.url; 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 * The icon URL of this footer
* @type {string} * @type {string}
*/ */
this.iconUrl = data.icon_url; this.iconURL = data.icon_url;
/** /**
* The proxy icon URL of this footer * The proxy icon URL of this footer