From abe8c824e3ae51c4c8a67ee162ff6831b6b52291 Mon Sep 17 00:00:00 2001 From: Emily J Date: Sun, 7 Mar 2021 01:14:46 +1100 Subject: [PATCH] add missing leading zeros to hex --- bot/util/functions.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot/util/functions.js b/bot/util/functions.js index 7b4d587..d41dac1 100644 --- a/bot/util/functions.js +++ b/bot/util/functions.js @@ -69,7 +69,12 @@ class Functions { if (!member) member = guild.members.get(this.client.user.id); const roles = this.roleObjects(guild, member.roles); for (const object of roles) { - if (object.color !== 0) return '#' + object.color.toString(16); + let hexadecimal = object.color.toString(16); + while (hexadecimal.length < 6) { + hexadecimal = '0' + hexadecimal; + }; + + return '#' + hexadecimal; } const colourKeys = Object.keys(colours);