> ## Documentation Index
> Fetch the complete documentation index at: https://yor.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Yor.ts | classes/ModalContext

[yor.ts](../README) / [Exports](../modules) / ModalContext

# Class: ModalContext

## Hierarchy

* `BaseContext`

  ↳ **`ModalContext`**

## Table of contents

### Constructors

* [constructor](ModalContext#constructor)

### Properties

* [API](ModalContext#api)
* [applicationId](ModalContext#applicationid)
* [channel](ModalContext#channel)
* [client](ModalContext#client)
* [components](ModalContext#components)
* [customId](ModalContext#customid)
* [interactionId](ModalContext#interactionid)
* [member](ModalContext#member)
* [raw](ModalContext#raw)
* [token](ModalContext#token)
* [user](ModalContext#user)

### Methods

* [decorate](ModalContext#decorate)
* [defer](ModalContext#defer)
* [deleteReply](ModalContext#deletereply)
* [editReply](ModalContext#editreply)
* [fetchReply](ModalContext#fetchreply)
* [followUp](ModalContext#followup)
* [isFromMessage](ModalContext#isfrommessage)
* [reply](ModalContext#reply)

## Constructors

### constructor

• **new ModalContext**(`client`, `data`): [`ModalContext`](ModalContext)

Initializes a new instance of the constructor.

#### Parameters

| Name     | Type                        | Description                               |
| :------- | :-------------------------- | :---------------------------------------- |
| `client` | [`YorClient`](YorClient)    | The client object.                        |
| `data`   | `APIModalSubmitInteraction` | The data to initialize the instance with. |

#### Returns

[`ModalContext`](ModalContext)

#### Overrides

BaseContext.constructor

#### Defined in

[src/structures/Contexts/ModalContext.ts:42](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L42)

## Properties

### API

• `Private` **API**: [`YorClientAPI`](YorClientAPI)

#### Defined in

[src/structures/Contexts/ModalContext.ts:34](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L34)

***

### applicationId

• `Readonly` **applicationId**: `string`

#### Defined in

[src/structures/Contexts/ModalContext.ts:26](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L26)

***

### channel

• **channel**: `undefined` | [`Channel`](Channel)

#### Defined in

[src/structures/Contexts/ModalContext.ts:30](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L30)

***

### client

• **client**: [`YorClient`](YorClient)

#### Inherited from

BaseContext.client

#### Defined in

[src/structures/Base.ts:4](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Base.ts#L4)

***

### components

• **components**: `ModalSubmitActionRowComponent`\[]

#### Defined in

[src/structures/Contexts/ModalContext.ts:29](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L29)

***

### customId

• `Readonly` **customId**: `string`

#### Defined in

[src/structures/Contexts/ModalContext.ts:24](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L24)

***

### interactionId

• `Readonly` **interactionId**: `string`

#### Defined in

[src/structures/Contexts/ModalContext.ts:25](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L25)

***

### member

• **member**: `undefined` | [`Member`](Member)

#### Defined in

[src/structures/Contexts/ModalContext.ts:32](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L32)

***

### raw

• `Readonly` **raw**: `APIModalSubmitInteraction`

#### Defined in

[src/structures/Contexts/ModalContext.ts:22](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L22)

***

### token

• `Readonly` **token**: `string`

#### Defined in

[src/structures/Contexts/ModalContext.ts:27](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L27)

***

### user

• **user**: `undefined` | [`User`](User)

#### Defined in

[src/structures/Contexts/ModalContext.ts:31](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L31)

## Methods

### decorate

▸ **decorate**(`name`, `data`): `unknown`

Decorates the object with a new property.

#### Parameters

| Name   | Type      | Description                         |
| :----- | :-------- | :---------------------------------- |
| `name` | `string`  | The name of the property.           |
| `data` | `unknown` | The data to assign to the property. |

#### Returns

`unknown`

The decorated object.

#### Inherited from

BaseContext.decorate

#### Defined in

[src/structures/Contexts/BaseContext.ts:22](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/BaseContext.ts#L22)

***

### defer

▸ **defer**(`ephemeral?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Defers the execution of the function.

#### Parameters

| Name        | Type      | Default value | Description                              |
| :---------- | :-------- | :------------ | :--------------------------------------- |
| `ephemeral` | `boolean` | `false`       | Whether the message is ephemeral or not. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

A promise that resolves when the deferral is complete.

#### Defined in

[src/structures/Contexts/ModalContext.ts:82](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L82)

***

### deleteReply

▸ **deleteReply**(): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Deletes a reply.

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

A promise that resolves when the reply is deleted.

#### Defined in

[src/structures/Contexts/ModalContext.ts:151](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L151)

***

### editReply

▸ **editReply**(`data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

Edits a reply.

#### Parameters

| Name   | Type                                                                                                                                                                                                                            | Description                     |
| :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------ |
| `data` | [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)\<`RESTPostAPIWebhookWithTokenJSONBody`, `"username"` \| `"avatar_url"`> & \{ `flags?`: `MessageFlags`  } & \{ `files?`: `RawFile`\[]  } | The data for editing the reply. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

A promise that resolves when the reply is edited.

#### Defined in

[src/structures/Contexts/ModalContext.ts:125](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L125)

***

### fetchReply

▸ **fetchReply**(): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

Fetches the reply asynchronously.

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

A promise that resolves when the original reply is fetched.

#### Defined in

[src/structures/Contexts/ModalContext.ts:160](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L160)

***

### followUp

▸ **followUp**(`data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

Calls the followUp method of the API class with the provided data.

#### Parameters

| Name   | Type                                                                                                                                                                                                                            | Description                                   |
| :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------- |
| `data` | [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)\<`RESTPostAPIWebhookWithTokenJSONBody`, `"username"` \| `"avatar_url"`> & \{ `flags?`: `MessageFlags`  } & \{ `files?`: `RawFile`\[]  } | The data to be passed to the followUp method. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

A promise that resolves to an APIMessage object.

#### Defined in

[src/structures/Contexts/ModalContext.ts:173](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L173)

***

### isFromMessage

▸ **isFromMessage**(): `boolean`

Determines if the function is from a message.

#### Returns

`boolean`

Returns true if the function is from a message, otherwise false.

#### Defined in

[src/structures/Contexts/ModalContext.ts:72](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L72)

***

### reply

▸ **reply**(`data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Replies to an interaction.

#### Parameters

| Name   | Type                                                                                                                                                                                                                            | Description                      |
| :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------- |
| `data` | [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)\<`RESTPostAPIWebhookWithTokenJSONBody`, `"username"` \| `"avatar_url"`> & \{ `flags?`: `MessageFlags`  } & \{ `files?`: `RawFile`\[]  } | The data for creating the reply. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

A promise that resolves when the reply is sent.

#### Defined in

[src/structures/Contexts/ModalContext.ts:102](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ModalContext.ts#L102)
