Class: ComponentContext
Hierarchy
-
BaseContext↳ComponentContext
Table of contents
Constructors
Properties
Methods
- decorate
- defer
- editReply
- followUp
- isButton
- isChannelSelectMenu
- isMentionableSelectMenu
- isRoleSelectMenu
- isStringSelectMenu
- isUserSelectMenu
- reply
- update
Constructors
constructor
• new ComponentContext(client, data): ComponentContext
Creates a new instance of the constructor.
Parameters
| Name | Type | Description |
|---|---|---|
client | YorClient | The client object. |
data | APIMessageComponentInteraction | The data for the constructor. |
Returns
ComponentContext
Overrides
BaseContext.constructorDefined in
src/structures/Contexts/ComponentContext.ts:35Properties
API
•Private API: YorClientAPI
Defined in
src/structures/Contexts/ComponentContext.ts:27applicationId
•Readonly applicationId: string
Defined in
src/structures/Contexts/ComponentContext.ts:21channel
• channel:Channel
Defined in
src/structures/Contexts/ComponentContext.ts:23client
• client:YorClient
Inherited from
BaseContext.clientDefined in
src/structures/Base.ts:4interactionId
•Readonly interactionId: string
Defined in
src/structures/Contexts/ComponentContext.ts:20member
• member:undefined | Member
Defined in
src/structures/Contexts/ComponentContext.ts:25raw
•Readonly raw: APIMessageComponentInteraction
Defined in
src/structures/Contexts/ComponentContext.ts:19token
•Readonly token: string
Defined in
src/structures/Contexts/ComponentContext.ts:22user
• user:undefined | User
Defined in
src/structures/Contexts/ComponentContext.ts:24Methods
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.decorateDefined in
src/structures/Contexts/BaseContext.ts:22defer
▸ defer():Promise<void>
Defer a message update.
Returns
Promise<void>
A promise that resolves when the message update is deferred.
Defined in
src/structures/Contexts/ComponentContext.ts:59editReply
▸ editReply(data): Promise<APIMessage>
Calls the editReply method of the API with the provided data.
Parameters
| Name | Type | Description |
|---|---|---|
data | Omit<RESTPostAPIWebhookWithTokenJSONBody, "username" | "avatar_url"> & { flags?: MessageFlags } & { files?: RawFile[] } | The data to be passed to the editReply method. |
Returns
Promise<APIMessage>
A promise that resolves to the response from the editReply method.
Defined in
src/structures/Contexts/ComponentContext.ts:121followUp
▸ followUp(data): Promise<APIMessage>
Calls the followUp method of the API with the provided data.
Parameters
| Name | Type | Description |
|---|---|---|
data | Omit<RESTPostAPIWebhookWithTokenJSONBody, "username" | "avatar_url"> & { flags?: MessageFlags } & { files?: RawFile[] } | The data to be passed to the followUp method. |
Returns
Promise<APIMessage>
A promise that resolves to the response from the followUp method.
Defined in
src/structures/Contexts/ComponentContext.ts:91isButton
▸ isButton():boolean
Determines if the element is a button.
Returns
boolean
- Returns
trueif the element is a button,falseotherwise.
Defined in
src/structures/Contexts/ComponentContext.ts:139isChannelSelectMenu
▸ 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:157isMentionableSelectMenu
▸ 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:166isRoleSelectMenu
▸ 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:175isStringSelectMenu
▸ 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:148isUserSelectMenu
▸ 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:184reply
▸ reply(data): Promise<void>
Reply to a message.
Parameters
| Name | Type | Description |
|---|---|---|
data | Omit<RESTPostAPIWebhookWithTokenJSONBody, "username" | "avatar_url"> & { flags?: MessageFlags } & { files?: RawFile[] } | The data to reply with. |
Returns
Promise<void>
A promise that resolves when the reply is sent.
Defined in
src/structures/Contexts/ComponentContext.ts:106update
▸ update(data): Promise<void>
Updates the message using the provided data.
Parameters
| Name | Type | Description |
|---|---|---|
data | Omit<RESTPostAPIWebhookWithTokenJSONBody, "username" | "avatar_url"> & { flags?: MessageFlags } & { files?: RawFile[] } | The updated message data. |
Returns
Promise<void>
A promise that resolves when the update is complete.
