mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
fix(MessageEmbed): avoid throwing error when accessing colorless hexColor
This commit is contained in:
@@ -113,10 +113,11 @@ class MessageEmbed {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The hexadecimal version of the embed color, with a leading hash
|
* The hexadecimal version of the embed color, with a leading hash
|
||||||
* @type {string}
|
* @type {?string}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get hexColor() {
|
get hexColor() {
|
||||||
|
if (!this.color) return null;
|
||||||
let col = this.color.toString(16);
|
let col = this.color.toString(16);
|
||||||
while (col.length < 6) col = `0${col}`;
|
while (col.length < 6) col = `0${col}`;
|
||||||
return `#${col}`;
|
return `#${col}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user