Get ApplicationCommand API data

Hi, how would I get API compatible data from an ApplicationCommand object? .toJSON() also returns stuff like guild and applicationId.
2 Replies
d.js toolkit
d.js toolkit16mo 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!
Xge
XgeOP16mo ago
From guild.commands.fetch(). I want to update the options of a few commands in a guild using
guild.commands.set(commands.map(c => {
let newOptions = updatedOptions.get(c.id);
if (!newOptions) return c.toJSON();
return {
...c.toJSON(),
options: newOptions
};
}))
guild.commands.set(commands.map(c => {
let newOptions = updatedOptions.get(c.id);
if (!newOptions) return c.toJSON();
return {
...c.toJSON(),
options: newOptions
};
}))
but I get this error when doing so, even though all descriptions are <70 characters:
Invalid Form Body
9.options[0].description[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 100 in length.
Invalid Form Body
9.options[0].description[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 100 in length.
Oh. One description has 0 characters.. Yeah I guess that was the issue. I am using .edit() when only a single command needs to be updated. But I'd like to make as few requests as possible when having to update 10 commands per guild Unable to test it right now, but I believe it would work now. Thank you for your time on this
Want results from more Discord servers?
Add your server