> ## Documentation Index
> Fetch the complete documentation index at: https://stars-components.js.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Function: RegisterSubcommand()

> **RegisterSubcommand**\<`Options`>(`data`, `subCommandGroupName?`): (`target`, `method`) => `void`

Defined in: [packages/http-framework/src/lib/interactions/decorators/RegisterSubcommand.ts:32](https://github.com/wolfstar-project/stars-components/blob/5aefd164bc5fc41e5a35d3abf908c288163dd354/packages/http-framework/src/lib/interactions/decorators/RegisterSubcommand.ts#L32)

Registers a subcommand for a chat input command.

## Type Parameters

### Options

`Options` *extends* [`PieceOptions`](/documentation/api/http-framework/interfaces/PieceOptions) = [`PieceOptions`](/documentation/api/http-framework/interfaces/PieceOptions)

## Parameters

### data

`SubcommandData`

The subcommand data.

### subCommandGroupName?

`string` | `null`

Optional name of the subcommand group.

## Returns

A decorator function that adds the subcommand to the target command.

(`target`, `method`) => `void`

## Remarks

This decorator must be used in conjunction with RegisterSubcommand.

## Example

```typescript theme={"system"}
import { Command, RegisterCommand, RegisterSubcommand, RegisterSubcommandGroup } from '@wolfstar/http-framework';

(at)RegisterCommand({
	name: 'ping',
	description: 'A simple ping pong command'
})
export class UserCommand extends Command {
	(at)RegisterSubcommand({
		name: 'subcommand',
		description: 'A simple subcommand'
	})
	public async run(interaction: Command.ChatInputInteraction) {
		return interaction.reply('Pong!');
	}
}
```
