Does d.js offer an easy way to validate commands?

I'm writing a bot utilizing builders to register commands. That part works fine. However, I'd like to check if the commands have been registered correctly. This is because I've released breaking changes to existing commands in the past. Also some of my users can't rtfm and don't run npm run deploy before npm start. I'd rather abstract this part away from them if there's a built-in way to do it. So... is there?
2 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
NKN1396
NKN1396OP3y ago
I'm imagining something akin to:
const builders = new Map() // Imagine this being filled with a bunch of builders
const commands = await client.application.commands.fetch()
const updateQueue = []

for (const command of commands) {
const builder = builders.get(command.name)
const needsCorrection = builder.validate(command)

if(needsCorrection) update.push(builder)
}

rest.put(route, {body: updateQueue})
const builders = new Map() // Imagine this being filled with a bunch of builders
const commands = await client.application.commands.fetch()
const updateQueue = []

for (const command of commands) {
const builder = builders.get(command.name)
const needsCorrection = builder.validate(command)

if(needsCorrection) update.push(builder)
}

rest.put(route, {body: updateQueue})
Not relevant, but d.js 14.1.2 + node 16.13.2 No error + no code since this is a question about a feature I might have missed. What a shame. Was hoping I had just overlooked something. Has this already been suggested as a feature by someone else? Also thanks for providing a workaround. Does force-fetching return the full command or is this one of those scenarios where the Discord API simply doesn't provide a way to do it?
Want results from more Discord servers?
Add your server