# RepliableHandler

`class` in `gateway` · v0.2.1-next.0

<https://docs.seedcord.org/packages/gateway/0.2.1-next.0/classes/repliable-handler>

Shared base the repliable interaction handlers extend.

Not a public entry point. Extend [`SlashHandler`](/packages/gateway/0.2.1-next.0/classes/slash-handler), [`ButtonHandler`](/packages/gateway/0.2.1-next.0/classes/button-handler), [`ModalHandler`](/packages/gateway/0.2.1-next.0/classes/modal-handler), [`SelectMenuHandler`](/packages/gateway/0.2.1-next.0/classes/select-menu-handler), or [`ContextMenuHandler`](/packages/gateway/0.2.1-next.0/classes/context-menu-handler) instead. This class binds the core reply base to the gateway sender.

```ts
abstract class RepliableHandler<
    Event extends Repliables
> extends RepliableHandler<
    Event,
    Core,
    SentMessage,
    GatewayFile,
    ReplySender
>
```

## Constructors

### constructor

```ts
protected RepliableHandler(
    event: Event,
    core: TCore,
    dispatch?: DispatchContext
)
```

Constructs a new instance of the `RepliableHandler` class

## Properties

### core

```ts
readonly core: TCore
```

### dispatch

```ts
protected readonly dispatch: DispatchContext | undefined
```

### event

```ts
protected readonly event: Event
```

### logger

```ts
protected readonly logger: Logger
```

### routeId

```ts
protected readonly routeId: string
```

### sender

```ts
protected readonly sender: TSender
```

## Methods

### buildSender

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

### defer

```ts
protected async defer(opts?: DeferOpts): Promise<void>
```

Show a "thinking" placeholder, then fill it later with [`edit`](/packages/gateway/0.2.1-next.0/classes/slash-handler#edit).

### delete

```ts
protected async delete(target?: TMessage): Promise<void>
```

Delete the initial reply or deferred placeholder. Pass a target to delete a message a prior send returned.

### edit

```ts
protected async edit(
    response: ReplyResponse<TNative> | string
): Promise<TMessage>
```

```ts
protected async edit(
    target: TMessage,
    response: ReplyResponse<TNative> | string
): Promise<TMessage>
```

Rewrite the initial reply or deferred placeholder. The targeted form rewrites a message a prior send returned.

### execute

```ts
abstract async execute(): Promise<void>
```

Holds the main logic of your handler. The dispatcher calls it after the handler's gates pass, so a gate that refuses stops `execute()` from running.

### followUp

```ts
protected async followUp(
    response: ReplyResponse<TNative> | string,
    opts?: SendOpts
): Promise<TMessage>
```

Send a new message once the interaction is acknowledged.

### reply

```ts
protected async reply(
    response: ReplyResponse<TNative> | string,
    opts?: SendOpts
): Promise<TMessage>
```

Send the initial response, exactly once.

### send

```ts
protected async send(
    response: ReplyResponse<TNative> | string,
    opts?: SendOpts
): Promise<TMessage>
```

Routes to reply, followUp, or edit based on the current ack state.
