mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00:00
Clean up colour resolver
This commit is contained in:
parent
df02eee065
commit
f647eb7a91
1 changed files with 4 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue