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

> **RequiresDMContext**(`fallback?`): `MethodDecorator`

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

Decorator that only runs the decorated method when the interaction was **not** received from a guild, that is, from a
DM or from a user-installed app context.

## Parameters

### fallback?

`ContextFallback` = `...`

The fallback to run when the interaction came from a guild. Defaults to a no-op, which silently skips
the method.

## Returns

`MethodDecorator`

A method decorator.

## Example

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

(at)RegisterCommand({ name: 'private', description: 'Only usable outside of servers' })
export class UserCommand extends Command {
	(at)RequiresDMContext((interaction: Command.ChatInputInteraction) =>
		interaction.reply({ content: 'This command cannot be used in a server.' })
	)
	public override chatInputRun(interaction: Command.ChatInputInteraction) {
		return interaction.reply({ content: 'Hello!' });
	}
}
```
