List registered commands and listeners

Hi, i love working with sapphire it's amazing. I'm just wondering is there a way to obtain some sort of array or map of registered/loaded commands and listeners ? Appreciate sincerely all the answers
Solution:
There are several ways to get the list of all commands, depending on the context of your current code. The following are the different methods: Inside another command:
this.store // Store<Command> extends Collection<Command> extends Map<Command>
this.store // Store<Command> extends Collection<Command> extends Map<Command>
...
Jump to solution
3 Replies
rehab
rehab9mo ago
some example what i would like to achieve
listOfCommands.forEach((cmd: Command) => console.log(cmd.name));
listOfCommands.forEach((cmd: Command) => console.log(cmd.name));
Solution
Spinel
Spinel9mo ago
There are several ways to get the list of all commands, depending on the context of your current code. The following are the different methods: Inside another command:
this.store // Store<Command> extends Collection<Command> extends Map<Command>
this.store // Store<Command> extends Collection<Command> extends Map<Command>
Inside another piece:
this.container.stores.get('commands') // Store<Command> extends Collection<Command> extends Map<Command>
this.container.stores.get('commands') // Store<Command> extends Collection<Command> extends Map<Command>
Anywhere else:
import { container } from '@sapphire/framework';

container.stores.get('commands') // Store<Command> extends Collection<Command> extends Map<Command>
import { container } from '@sapphire/framework';

container.stores.get('commands') // Store<Command> extends Collection<Command> extends Map<Command>
rehab
rehab9mo ago
That's exactly what i was looking for thank you so much
Want results from more Discord servers?
Add your server