Skip to main content

📔 Command Repository

The CommandRepository is the object responsible for storing commands. It's stored by a CommandManager, and you can get it via CommandManager#getRepository().

You can't modify the repository directly since the CommandManager returns a ReadonlyCommandRepository type, but the hidden methods are available at the CommandManager. This is because adding, removing and updating a command needs more logic than just modifying the repository, and the manager is responsible for coordinating this.

👷 Creation

You can create a command repository by either:

  • Extending DefaultCommandRepository from @framework (recommended).
  • Implementing the CommandRepository interface from @core.
class MyCommandRepository extends DefaultCommandRepository {
// ...
}

const myRepository = new MyCommandRepository();

const myBot = Bot.create((bot) => ({
commands: DefaultCommandManager.create(bot, client, clientBus, { repository: myRepository }),
}));