TypeError [ColorConvert]: Unable to convert "16705372" to a number

Hey, I am using discord.js@14.15.0-dev.1707091779-f401cff3f, and when importing Colors from discord.js and using .setColor(Colors.Red), it gives me the error: TypeError [ColorConvert]: Unable to convert "16705372" to a number Any ideas on how to fix it?
8 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Stew
Stew3mo ago
Example function that produces this error:
return interaction.reply({
embeds: [new EmbedBuilder()
.setColor(Colors.Red)
.setDescription(`message`)]
});
return interaction.reply({
embeds: [new EmbedBuilder()
.setColor(Colors.Red)
.setDescription(`message`)]
});
mallusrgreat
mallusrgreat3mo ago
from where did you import embedbuilder
Stew
Stew3mo ago
const { EmbedBuilder, Colors, resolveColor } = require('discord.js');
mallusrgreat
mallusrgreat3mo ago
looks like an issue for #djs-in-dev-version then
Stew
Stew3mo ago
I added the dev release tag The errors indicate that the line where it happens use .setColor(Colors.Red) It errors for .setColor(Colors.Yellow) too I tried hardcoding the values like this:
.setColor(16776960)
.setColor(16776960)
but it prints the same error for some reason
TypeError [ColorConvert]: Unable to convert "16705372" to a number.
at resolveColor (/node_modules/discord.js/src/util/Util.js:293:11)
at EmbedBuilder.setColor (/node_modules/discord.js/src/structures/EmbedBuilder.js:23:36)
at PromoCommand.run (/commands/promo/promo.js:174:18)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async CommandHandler.onInteraction (/node_modules/slash-commando/dist/types/BaseHandler.js:65:13) {
code: 'ColorConvert'
}
TypeError [ColorConvert]: Unable to convert "16705372" to a number.
at resolveColor (/node_modules/discord.js/src/util/Util.js:293:11)
at EmbedBuilder.setColor (/node_modules/discord.js/src/structures/EmbedBuilder.js:23:36)
at PromoCommand.run (/commands/promo/promo.js:174:18)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async CommandHandler.onInteraction (/node_modules/slash-commando/dist/types/BaseHandler.js:65:13) {
code: 'ColorConvert'
}
.setColor(Colors.Yellow) In this context:
await interaction.reply({
embeds: [new EmbedBuilder()
.setColor(Colors.Yellow)
.setDescription("...")
],
});
await interaction.reply({
embeds: [new EmbedBuilder()
.setColor(Colors.Yellow)
.setDescription("...")
],
});
Stew
Stew3mo ago
GitHub
fix(resolveColor): Address case for numbers (#10115) · discordjs/di...
fix(resolveColor): address case for numbers Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Stew
Stew3mo ago
This fixed the issue, I didn't even know I was using such an old version of d.js@dev Thanks for the dedicated time tho