Subcommands

Subcommands are a little different. They need the reference property and their options are located in the base command. Here is an example:

Note: you can handle the subcommands in the main command if you do not create the SLSubCommand.

Base/Main Command:

commands/user.js
const { ChatInputCommand } = require('sl-commands')

new ChatInputCommand()
  /** The command name (required) */
  .setName('ping')
  /** The command description (required) */
  .setDescription('Shows my ping')
  /** If only bot developers will be able to use the command */
  .setDevsOnly(true)
  /** Whether the command will be only registered in test servers or not */
  .setTestOnly(true)
  /** The required server permissions for using the command */
  .setRequiredPermissions('Administrator')
  /** There's a lot of types of options, this is one example of how to add one boolean option */
  .addSubcommand(option => option.setName('show').setDescription('Testing'))
  /** onExecute not required (useless) */

Sub command:

Last updated