> ## 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/ComponentContext

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

# Class: ComponentContext

## Hierarchy

* `BaseContext`

  ↳ **`ComponentContext`**

## Table of contents

### Constructors

* [constructor](ComponentContext#constructor)

### Properties

* [API](ComponentContext#api)
* [applicationId](ComponentContext#applicationid)
* [channel](ComponentContext#channel)
* [client](ComponentContext#client)
* [interactionId](ComponentContext#interactionid)
* [member](ComponentContext#member)
* [raw](ComponentContext#raw)
* [token](ComponentContext#token)
* [user](ComponentContext#user)

### Methods

* [decorate](ComponentContext#decorate)
* [defer](ComponentContext#defer)
* [editReply](ComponentContext#editreply)
* [followUp](ComponentContext#followup)
* [isButton](ComponentContext#isbutton)
* [isChannelSelectMenu](ComponentContext#ischannelselectmenu)
* [isMentionableSelectMenu](ComponentContext#ismentionableselectmenu)
* [isRoleSelectMenu](ComponentContext#isroleselectmenu)
* [isStringSelectMenu](ComponentContext#isstringselectmenu)
* [isUserSelectMenu](ComponentContext#isuserselectmenu)
* [reply](ComponentContext#reply)
* [update](ComponentContext#update)

## Constructors

### constructor

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

Creates a new instance of the constructor.

#### Parameters

| Name     | Type                             | Description                   |
| :------- | :------------------------------- | :---------------------------- |
| `client` | [`YorClient`](YorClient)         | The client object.            |
| `data`   | `APIMessageComponentInteraction` | The data for the constructor. |

#### Returns

[`ComponentContext`](ComponentContext)

#### Overrides

BaseContext.constructor

#### Defined in

[src/structures/Contexts/ComponentContext.ts:35](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L35)

## Properties

### API

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

#### Defined in

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

***

### applicationId

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

#### Defined in

[src/structures/Contexts/ComponentContext.ts:21](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L21)

***

### channel

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

#### Defined in

[src/structures/Contexts/ComponentContext.ts:23](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L23)

***

### 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)

***

### interactionId

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

#### Defined in

[src/structures/Contexts/ComponentContext.ts:20](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L20)

***

### member

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

#### Defined in

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

***

### raw

• `Readonly` **raw**: `APIMessageComponentInteraction`

#### Defined in

[src/structures/Contexts/ComponentContext.ts:19](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L19)

***

### token

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

#### Defined in

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

***

### user

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

#### Defined in

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

## 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**(): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Defer a message update.

#### Returns

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

A promise that resolves when the message update is deferred.

#### Defined in

[src/structures/Contexts/ComponentContext.ts:59](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L59)

***

### editReply

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

Calls the `editReply` method of the API 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 `editReply` method. |

#### Returns

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

A promise that resolves to the response from the `editReply` method.

#### Defined in

[src/structures/Contexts/ComponentContext.ts:121](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L121)

***

### followUp

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

Calls the `followUp` method of the API 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 the response from the `followUp` method.

#### Defined in

[src/structures/Contexts/ComponentContext.ts:91](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L91)

***

### isButton

▸ **isButton**(): `boolean`

Determines if the element is a button.

#### Returns

`boolean`

* Returns `true` if the element is a button, `false` otherwise.

#### Defined in

[src/structures/Contexts/ComponentContext.ts:139](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L139)

***

### isChannelSelectMenu

▸ **isChannelSelectMenu**(): `boolean`

Checks if the component is a channel select menu.

#### Returns

`boolean`

* Returns true if the component is a channel select menu, otherwise false.

#### Defined in

[src/structures/Contexts/ComponentContext.ts:157](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L157)

***

### isMentionableSelectMenu

▸ **isMentionableSelectMenu**(): `boolean`

Determines if the select menu is mentionable.

#### Returns

`boolean`

True if the select menu is mentionable, false otherwise.

#### Defined in

[src/structures/Contexts/ComponentContext.ts:166](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L166)

***

### isRoleSelectMenu

▸ **isRoleSelectMenu**(): `boolean`

Determines if the function is a role select menu.

#### Returns

`boolean`

True if the function is a role select menu, false otherwise.

#### Defined in

[src/structures/Contexts/ComponentContext.ts:175](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L175)

***

### isStringSelectMenu

▸ **isStringSelectMenu**(): `boolean`

Determines if the select menu is of type string.

#### Returns

`boolean`

true if the select menu is of type string, false otherwise

#### Defined in

[src/structures/Contexts/ComponentContext.ts:148](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L148)

***

### isUserSelectMenu

▸ **isUserSelectMenu**(): `boolean`

Determines whether the component type of the raw data is a UserSelect.

#### Returns

`boolean`

true if the component type is UserSelect, false otherwise

#### Defined in

[src/structures/Contexts/ComponentContext.ts:184](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L184)

***

### reply

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

Reply to a message.

#### 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 reply with. |

#### 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/ComponentContext.ts:106](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Contexts/ComponentContext.ts#L106)

***

### update

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

Updates the message using 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 updated message data. |

#### Returns

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

A promise that resolves when the update is complete.

#### Defined in

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