> ## 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: ApplyOptions()

> **ApplyOptions**\<`Options`>(`optionsOrFn`): `ClassDecorator`

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

Decorator that sets the options of a `Piece`, such as a `Command`, a `Listener`, or an `InteractionHandler`.

## Type Parameters

### Options

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

## Parameters

### optionsOrFn

`Options` | ((`context`) => `Options`)

The options to pass to the piece's constructor, or a function that builds them from the loader
context.

## Returns

`ClassDecorator`

A class decorator.

## Remarks

The options are merged on top of the ones the piece was constructed with, so a piece that also passes
options through `super(context, options)` will have the decorator's values win on conflicting keys.

## Examples

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

(at)ApplyOptions<Command.Options>({ name: 'ping', enabled: true })
(at)RegisterCommand({ name: 'ping', description: 'A simple ping pong command' })
export class UserCommand extends Command {
	public override chatInputRun(interaction: Command.ChatInputInteraction) {
		return interaction.reply({ content: 'Pong!' });
	}
}
```

```typescript theme={"system"}
(at)ApplyOptions<Command.Options>(({ name }) => ({ name: name.toLowerCase() }))
export class UserCommand extends Command {}
```
