# ContextMenuHandler

`class` in `http` · v0.1.0-next.0

<https://docs.seedcord.org/packages/http/0.1.0-next.0/classes/context-menu-handler>

Base class for a context-menu command handler on the HTTP transport (right-click a user or a message).

Pass the kind from ApplicationCommandType as the generic. Read the right-clicked entity from `this.target`, an `APIUser` for a user menu and an `APIMessage` for a message menu. Context menus carry no options, so a handler registered for several names reads `this.target` uniformly with no per-name branch.

```ts
abstract class ContextMenuHandler<
    Kind extends ContextMenuKind
> extends InteractionHandler<InteractionFor<Kind>>
```

## Constructors

### constructor

```ts
InteractionHandler(
    event: Event,
    core: Core,
    dispatch?: DispatchContext
)
```

Constructs a new instance of the `InteractionHandler` class

## Properties

### target

```ts
protected target: TargetFor<Kind>
```

### targetMember

```ts
protected targetMember: TargetMemberFor<Kind>
```

The right-clicked user's guild member, resolved only on user menus fired in a guild. Reading it on a message menu is a compile error.

## Methods

### buildSender

```ts
protected buildSender(
    event: Event,
    core: Core,
    routeId: string
): ReplySender
```

### showModal

```ts
protected async showModal(
    this: InteractionHandler<
        Exclude<Repliables, APIModalSubmitInteraction>
    >,
    modal: ModalLike
): Promise<void>
```

Open a modal. Must be the initial response to this interaction. The modal kind rejects this call at compile time (Discord forbids a modal in response to a modal).
