Using the base command and the subcommand as well

Hey! I am currently migrating an old bot to use slash commands but I am currently stuck with the following issue. I am browsing the Discord Dev Portal docs regarding subcommands and subcommand groups and read this line:
Using subcommands or subcommand groups will make your base command unusable.
I have a command that is currently being used in the legacy (prefix-based system): - -shop - returns a link - -shop buy <ITEM_ID> - adds an item to inventory I was wondering if there would be a decent way of migrating this to slash commands. I considered using options and checking if option one is "buy" then validated option two "<ITEM_ID>" and both of them being optional so we could also continue to use -shop alone. This, however, doesn't feel like a graceful solution. Are there any recommendations of how this could be achieved? EDIT: using v14.5.0 but that isn't available as a tag. Node v18.6.1.
3 Replies
d.js toolkit
d.js toolkit10mo 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
treble/luna
treble/luna10mo ago
first of all update your djs version and yes, subcommands make the base command unavailable to use, so you'll have to come up with something else, like a string option with choices
Veeru
Veeru10mo ago
PAIN. But alright. Might adjust the command to use -shop link or smth instead. Thanks!