Skip to main content

Acquiring an Application Command Registry

To work with an application command registry, you must "acquire" one for your commands. We can do this by using the pre-defined registry for a command through the registerApplicationCommands method argument of the Command class.

const { Command } = require('@sapphire/framework');

class PingCommand extends Command {
registerApplicationCommands(registry) {
// registry is unique to this command
module.exports = {

Acquiring and accessing the application command registry this way is only associated with PingCommand - it will not interact with any other of your commands.


For most users, the method above should suffice. Another way of acquiring an application command registry is through ApplicationCommandRegistries.acquire(), but it should only be chosen for advanced usage such as handling application command registration outside a command or creating TypeScript decorators.

const { ApplicationCommandRegistries } = require('@sapphire/framework');

// Acquires the registry keyed by 'ping'
const pingRegistry = ApplicationCommandRegistries.acquire('ping');

Read Registering Application Commands outside a Command for more details