# ReplySender

`class` in `gateway` · v0.6.0

<https://docs.seedcord.org/packages/gateway/0.6.0/classes/reply-sender>

Writes interaction responses through discord.js. The repliable handler bases and the dispatcher construct it.

```ts
class ReplySender extends BaseReplySender<
    SentMessage,
    GatewayFile
>
```

## Constructors

### constructor

```ts
ReplySender(
    interaction: Repliables,
    dispatch: DispatchContext,
    bus: Bus
)
```

Constructs a new instance of the `ReplySender` class

## Properties

### routeId

```ts
protected routeId: string
```

## Methods

### defer

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

### deferUpdate

```ts
async deferUpdate(): Promise<void>
```

### delete

```ts
async delete(): Promise<void>
```

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

### edit

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

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

### followUp

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

### guardModalSource

```ts
protected guardModalSource(): void
```

### remember

```ts
protected remember(created: TMessage): TMessage
```

### reply

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

### send

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

Routes to the verb the current ack state permits. Every state has a route, so the illegal-ack throw is unreachable.

### serialize

```ts
protected serialize(
    response: ReplyResponse<TNative> | string
): SerializedReply<TNative>
```

### showModal

```ts
async showModal(
    modal: ModalLike
): Promise<void>
```

Must be the initial response.

### update

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

After a deferUpdate the state stays deferred-update. Calling this again rewrites. The returned message is the source message, editable only through a bare `update` or `edit`. A targeted `edit` or `delete` of it throws the foreign-target error.

### writeDefer

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

### writeDeferUpdate

```ts
protected async writeDeferUpdate(): Promise<void>
```

### writeDeleteOriginal

```ts
protected async writeDeleteOriginal(): Promise<void>
```

### writeDeleteTarget

```ts
protected async writeDeleteTarget(
    targetId: string
): Promise<void>
```

### writeEditOriginal

```ts
protected async writeEditOriginal(
    response: GatewayReplyResponse | string
): Promise<SentMessage>
```

### writeEditTarget

```ts
protected async writeEditTarget(
    targetId: string,
    response: GatewayReplyResponse | string
): Promise<SentMessage>
```

### writeFollowUp

```ts
protected async writeFollowUp(
    response: GatewayReplyResponse | string,
    opts?: SendOpts
): Promise<SentMessage>
```

### writeModal

```ts
protected async writeModal(
    data: APIModalInteractionResponseCallbackData
): Promise<void>
```

### writeReply

```ts
protected async writeReply(
    response: GatewayReplyResponse | string,
    opts?: SendOpts
): Promise<SentMessage | undefined>
```

### writeUpdate

```ts
protected async writeUpdate(
    response: GatewayReplyResponse | string
): Promise<SentMessage | undefined>
```
