Skip to main content

Getting Started


Subcommands are a way to split 1 command into multiple. This can in particular be very useful for configuration commands with subcommands such as set, reset and remove.


npm install @sapphire/plugin-subcommands @sapphire/framework @sapphire/utilities discord.js


import { SubCommandPluginCommand } from '@sapphire/plugin-subcommands';
import type { Args } from '@sapphire/framework';
import type { Message } from 'discord.js';

// Extend `SubCommandPluginCommand` instead of `Command`
export class UserCommand extends SubCommandPluginCommand {
public constructor(context: SubCommandPluginCommand.Context, options: SubCommandPluginCommand.Options) {
super(context, {
subCommands: ['add', 'remove', 'list', 'reset', { input: 'show', default: true }]

// Do not include a `messageRun` method, each method name should match with the subcommand names
public async add(message: Message, args: Args) {}

public async remove(message: Message, args: Args) {}

public async list(message: Message, args: Args) {}

public async reset(message: Message, args: Args) {}

public async show(message: Message, args: Args) {}