mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Clean up colour resolver
This commit is contained in:
@@ -354,6 +354,7 @@ class ClientDataResolver {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves a ColorResolvable into a color number
|
||||
* @param {ColorResolvable} color Color to resolve
|
||||
* @returns {number} A color
|
||||
*/
|
||||
@@ -363,11 +364,13 @@ class ClientDataResolver {
|
||||
} else if (color instanceof Array) {
|
||||
color = (color[0] << 16) + (color[1] << 8) + color[2];
|
||||
}
|
||||
|
||||
if (color < 0 || color > 0xFFFFFF) {
|
||||
throw new RangeError('Color must be within the range 0 - 16777215 (0xFFFFFF).');
|
||||
} else if (color && isNaN(color)) {
|
||||
throw new TypeError('Unable to convert color to a number.');
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -376,7 +379,7 @@ class ClientDataResolver {
|
||||
* @returns {number} A color
|
||||
*/
|
||||
resolveColor(color) {
|
||||
return ClientDataResolver.resolveColor(color);
|
||||
return this.constructor.resolveColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user