yor.ts / Exports / ComponentContext

Class: ComponentContext

Hierarchy

  • BaseContext

    ComponentContext

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ComponentContext(client, data): ComponentContext

Creates a new instance of the constructor.

Parameters

NameTypeDescription
clientYorClientThe client object.
dataAPIMessageComponentInteractionThe data for the constructor.

Returns

ComponentContext

Overrides

BaseContext.constructor

Defined in

src/structures/Contexts/ComponentContext.ts:35

Properties

API

Private API: YorClientAPI

Defined in

src/structures/Contexts/ComponentContext.ts:27


applicationId

Readonly applicationId: string

Defined in

src/structures/Contexts/ComponentContext.ts:21


channel

channel: Channel

Defined in

src/structures/Contexts/ComponentContext.ts:23


client

client: YorClient

Inherited from

BaseContext.client

Defined in

src/structures/Base.ts:4


interactionId

Readonly interactionId: string

Defined in

src/structures/Contexts/ComponentContext.ts:20


member

member: undefined | Member

Defined in

src/structures/Contexts/ComponentContext.ts:25


raw

Readonly raw: APIMessageComponentInteraction

Defined in

src/structures/Contexts/ComponentContext.ts:19


token

Readonly token: string

Defined in

src/structures/Contexts/ComponentContext.ts:22


user

user: undefined | User

Defined in

src/structures/Contexts/ComponentContext.ts:24

Methods

decorate

decorate(name, data): unknown

Decorates the object with a new property.

Parameters

NameTypeDescription
namestringThe name of the property.
dataunknownThe data to assign to the property.

Returns

unknown

The decorated object.

Inherited from

BaseContext.decorate

Defined in

src/structures/Contexts/BaseContext.ts:22


defer

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:59


editReply

editReply(data): Promise<APIMessage>

Calls the editReply method of the API with the provided data.

Parameters

NameTypeDescription
dataOmit<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:121


followUp

followUp(data): Promise<APIMessage>

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

Parameters

NameTypeDescription
dataOmit<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:91


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


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


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


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


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


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


reply

reply(data): Promise<void>

Reply to a message.

Parameters

NameTypeDescription
dataOmit<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:106


update

update(data): Promise<void>

Updates the message using the provided data.

Parameters

NameTypeDescription
dataOmit<RESTPostAPIWebhookWithTokenJSONBody, "username" | "avatar_url"> & { flags?: MessageFlags } & { files?: RawFile[] }The updated message data.

Returns

Promise<void>

A promise that resolves when the update is complete.

Defined in

src/structures/Contexts/ComponentContext.ts:72