mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 08:41:29 +00:00
fix(MessageEmbed): avoid throwing error when accessing colorless hexColor
This commit is contained in:
parent
3ba26ad972
commit
b60ee25038
1 changed files with 2 additions and 1 deletions
|
|
@ -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}`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue