You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make bot post embed message, but set the embed color to one of these strings in all lowercase
In the Discord client, the embed will appear black, instead of the color it is supposed to be.
Usually when you pass a color that's not valid, it generates an error, but for some reason the case insensitive colors pass without error and then don't apply.
Code sample
client.on("messageCreate",msg=>{if(msg.author.bot)return;try{constembed=newEmbedBuilder();embed.setColor(msg.content);embed.setTitle("Selected color");embed.setDescription(msg.content);msg.channel.send({embeds: [embed]});}catch{constembed=newEmbedBuilder();embed.setTitle("Incorrect color");embed.setDescription(`${msg.content} is not a valid color.`);msg.channel.send({embeds: [embed]});}});
Package version
14.7.1
Node.js version
19.2.0
Operating system
Arch Linux 5.15.83-1-lts
Priority this issue should have
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildMessages, MessageContent
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered:
As we already know, a lower case variant of any colour is not valid. Thus, parseInt(color.replace('#', ''), 16) is used for color instead. This is doing parseInt('b', 16) (in this case) and returns 11 - the first & only match.
I am not sure if fixing this would be major, however.
Which package is this bug report for?
discord.js
Issue description
Usually when you pass a color that's not valid, it generates an error, but for some reason the case insensitive colors pass without error and then don't apply.
Code sample
Package version
14.7.1
Node.js version
19.2.0
Operating system
Arch Linux 5.15.83-1-lts
Priority this issue should have
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildMessages, MessageContent
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: