mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
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:
parent
e51fed968d
commit
c5f93eb44e
1 changed files with 30 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue