Dupliacte commands
When registering commands with Sapphire, it created duplicate ones on top of the old ones from legacy codebase. How can I delete duplicate ones so only the currently active (Sapphire generated ones) remain? Deleting all commands and re-registering them is also an option I can do, just not sure how
25 Replies
Use the DiscordJS methods for managing commands (
client.application.commands
is the store) or use a webapp such as https://slash-commands-gui.androz2091.fr
Alternatively switch to Bulk Overwrite mode so every command is always overwrittenSlash Commands GUI
Graphical User Interface to explore and edit your bot's slash commands!
Where do I set bulk overwrite mode?
Thank you!
@Boomeravna I'm not sure if bulk overwrite resolved my issue, I still see all the old commands and duplicate ones even after restarting Discord client
Log:
Do they also show when typing a
/
instead of going through the integrations menu?
anyway you can use the website I linked to verifyYes
I don't feel confident putting in client secret to a website, sorry
first of all, you can reset it afterwards. Secondly, it's an open source project so you can verify the code yourself: https://github.com/Androz2091/slash-commands-gui
GitHub
GitHub - Androz2091/slash-commands-gui: GUI tool to explore Slash C...
GUI tool to explore Slash Commands of your bot, built on Vue 3 and TailwindCSS 🚀 - Androz2091/slash-commands-gui
but if you still dont want to, then use the aforementioned discordjs methods
never forget that Sapphire is a framework on top of DiscordJS, ergo anything that's possible with DiscordJS is possible with Sapphire. And for DiscordJS there is https://discordjs.guide/
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
It should be only 4 commands, and it's missing one of them on that list
that is very weird. Could it be that some are guild specific commands and others are global commands?
because this should not be possible at all with bulk overwrite and the logs clearly say it was successfully overwritten
Not sure, I didn't work on the project before. How can I flush them all?
what exactly do you mean "i didnt work on the project before"? Are you adopting someone else's code?
Yes, I have the old code, but it's an outdated hot mess that I'm rewriting and reworking the functionality
Hmmm
Anyways, I just want to cleanup all those commands and have them re-register
See I would say you can use the discordjs store to unregister the commands
But if the code is messy then they might just re-register right afterwards
You can try it I suppose
Old code is no longer used, only new one based on Sapphire
It's why I want to cleanup
It's a Collection so you can loop through it like any djs Collection to get all the ids and then call delete https://discord.js.org/docs/packages/discord.js/14.17.3/ApplicationCommandManager:Class
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Oh and there's https://discord.js.org/docs/packages/discord.js/14.17.3/GuildApplicationCommandManager:Classfor guild specific commands. For this you'll need a double loop, outer loop for each guild, inner loop for the command ids
Great, I'll look into it. Thanks for help!
Hopefully it'll solve the issue because I'm a bit stumped on it otherwise as it's quite weird
If it doesn't it might be easiest for me to receive the code so I can look through what you're running now