Automatically delete a old slash command that has been renamed?

Yyusof12/5/2022
How would I achieve this, I am using sapphire 3.1.3, and I want it to automatically delete the old one when it detects a change.
FFavna12/5/2022
Sapphire currently doesn't have a feature to automatically delete slash commands. You can use the DJS methods for now. In the future we'll add a feature where we would use the Build Overwrite endpoint of the API meaning on every boot all your commands get wiped and reset - with the caveat that idHints will lose its use case when that is configured.
Yyusof12/5/2022
is it possible to make a listener of sort
FFavna12/5/2022
in the ready listener you could check which commands are in the Command store and which you can find through the DJS application commands methods, diff those lists and remove any that are not in the Commands store
Yyusof12/5/2022
yeah thats what im doing rn
Yyusof12/5/2022
would this line of code work client.application?.commands.cache.forEach((command: ApplicationCommand) => {command.delete()})
FFavna12/5/2022
I actually have absolutely no idea lol sorry
Yyusof12/5/2022
im testing it rn
Yyusof12/5/2022
lets see
FFavna12/5/2022
client.application?.commands.set([]) I think this works too
FFavna12/5/2022
at least the docs say it does
Yyusof12/5/2022
client.application?.commands.set([]);
FFavna12/5/2022
but you cannot use that in the ready listener because you'll delete everything sapphire just registered ofr you
FFavna12/5/2022
you need to diff the lists
Yyusof12/5/2022
how would I list the commands then
FFavna12/5/2022
Yyusof12/5/2022
excuse me
Yyusof12/5/2022
where did container come from
Yyusof12/5/2022
oh wait nvm
Yyusof12/5/2022
?
Image
FFavna12/5/2022
it's not a promise
FFavna12/5/2022
I'm not going to spoonfeed you code fyi. I gave you the directions to go for, you're on your own from there on.
KKrish12/5/2022
I suggest making a script file to delete all of the slash commands at once (or just give the IDs) with rest api and rust that file wheneber you want to reset the commands.
Yyusof12/6/2022
yeah I cant figure this out
Yyusof12/6/2022
I never even told you to spoonfeed me
Yyusof12/6/2022
so ok
Solution
FFavna12/16/2022
A PR has been created that will add this as a feature