mirror of
https://github.com/danbulant/discord.js
synced 2026-05-29 12:20:23 +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
|
||||
* @type {string}
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
*/
|
||||
get hexColor() {
|
||||
if (!this.color) return null;
|
||||
let col = this.color.toString(16);
|
||||
while (col.length < 6) col = `0${col}`;
|
||||
return `#${col}`;
|
||||
|
|
|
|||
Loading…
Reference in a new issue