How to get subcommand name from interaction object?
I am will be having multiple commands which have their own sub commands (3 sub command per parent command).
Out of those 3 sub commands, 2 of them will have AutoComplete.
How do I distinguish between sub commands?
interaction.commandName
gives only the parent command name, not sub command name4 Replies
Solution
After some research I found out that this can be done using:
This gives the sub command name by which you can do respective operations
You're correct. Should also note that this is DJS btw, not sapphire 🙂
I realised this after finding out the solution 😅
For some reason, my autocomplete doesn't work, on which I'll do more research & maybe create appropriate thread
Make sure that the option has autocomplete enabled in the registry and that it's a supported type. Also make sure the interaction handler is in the correct folder and such (
interaction-handlers
by default). And the handler has the correct type.
Quite a few things to account for. It should all be covered in our guide. https://www.sapphirejs.dev/docs/Guide/interaction-handlers/autocompleteSapphire Framework
Autocomplete | Sapphire
Certain Chat Input Command options can be autocompleted based on what the user has written. There are two ways you can