feat(utils): Support 'random' in setColor (#4093)

* support 'random' in setColor

* use toLowerCase for color in setColor
This commit is contained in:
Fleny
2025-01-16 22:25:13 -06:00
committed by GitHub
parent 7fc1f12e4c
commit a55127fb93
+4
View File
@@ -100,6 +100,10 @@ export class EmbedsBuilder extends Array<DiscordEmbed> {
*/
setColor(color: number | string): this {
if (typeof color === 'string') {
if (color.toLowerCase() === 'random') {
return this.setRandomColor()
}
const convertedValue = parseInt(color.replace('#', ''), 16)
color = Number.isNaN(convertedValue) ? 0 : convertedValue
}