Skip to main content

Registering Application Commands outside a Command

You are able to register your application commands inside of their command class, but also outside of the class! Whether it's a dynamic command or premium command, Sapphire can help you manage your application commands with ease.

danger

You shouldn't use all three methods at the same time, just one is enough! This is just an example of all three variants.

import { SlashCommandBuilder } from '@discordjs/builders';import { ApplicationCommandRegistries } from '@sapphire/framework';// Acquires the registry keyed by 'uwu'const registry = ApplicationCommandRegistries.acquire('uwu');// Registering with the discord.js options objectregistry.registerChatInputCommand({  name: 'uwu',  description: 'Sends a uwu in chat'});// Registering with the builderconst builder = new SlashCommandBuilder().setName('uwu').setDescription('Sends a uwu in chat');registry.registerChatInputCommand(builder);// Registering with the builder provided by the methodregistry.registerChatInputCommand((builder) => builder.setName('uwu').setDescription('Sends a uwu in chat'));