Pattern for fetching all registered slash commands

I have some slash commands and some with subcommands and and want to introduce a /help slash command that shows all the available guild commands and their description? I want to get the names and descriptions for all the slash commands. I realize I can use the raw discord client to fetch that registered commands and parse then use that. However, I'm trying to see if it's possible to avoid making those additional network calls. Thanks.
Solution:
You can get all your command classes from the commands store. Thats accessed using client.stores.get('commands')
Jump to solution
3 Replies
Solution
Ben
Ben2y ago
You can get all your command classes from the commands store. Thats accessed using client.stores.get('commands')
Favna
Favna2y ago
why would you need this though. People can just type /<bot name> to get the list. For example if you type /teryl you get all Teryl commands, if you type /spinel you get all Spinel commands. These are native Discord features. There is hardly ever a need for a help command when you use slash commands.
Doob
Doob2y ago
@Favna I now agree. In doing this, I was fighting the intended pattern for slash commands. I was trying to provide parity with chat commands but in do so I'm not respecting how slash commands should work. FWIW, @Ben855 's suggestion worked as I expected except for with the SubCommand type where I was unable to access the description of sub-commands.
Want results from more Discord servers?
Add your server