Skip to content

ComponentContext

Represents a context for interacting with components in a Discord bot.

Extends

Type parameters

Type parameterDescription
Type extends keyof ComponentCommandInteractionMapThe type of component interaction.

Constructors

new ComponentContext(client, interaction)

1
new ComponentContext<Type>(client: UsingClient, interaction: ComponentInteraction<boolean, APIMessageComponentInteraction> | ComponentCommandInteractionMap[Type]): ComponentContext<Type>

Creates a new instance of the ComponentContext class.

Parameters

ParameterTypeDescription
clientUsingClientThe UsingClient instance.
interactionComponentInteraction<boolean, APIMessageComponentInteraction> | ComponentCommandInteractionMap[Type]The component interaction object.

Returns

ComponentContext<Type>

Inherited from

BaseContext.constructor

Source

seyfert/src/components/componentcontext.ts:40

Properties

PropertyModifierTypeDescriptionInherited from
clientreadonlyUsingClientThe UsingClient instance.BaseContext.client
interactionpublicComponentInteraction<boolean, APIMessageComponentInteraction> | ComponentCommandInteractionMap[Type]The component interaction object.-

Accessors

author

1
get author(): User

Gets the author of the interaction.

Returns

User

Source

seyfert/src/components/componentcontext.ts:189


channelId

1
get channelId(): string

Gets the ID of the channel of the interaction.

Returns

string

Source

seyfert/src/components/componentcontext.ts:182


customId

1
get customId(): string

Gets the custom ID of the interaction.

Returns

string

Source

seyfert/src/components/componentcontext.ts:64


guildId

1
get guildId(): undefined | string

Gets the ID of the guild of the interaction.

Returns

undefined | string

Source

seyfert/src/components/componentcontext.ts:175


member

1
get member(): undefined | InteractionGuildMember

Gets the member of the interaction.

Returns

undefined | InteractionGuildMember

Source

seyfert/src/components/componentcontext.ts:196


proxy

1
get proxy(): APIRoutes

Gets the proxy object.

Returns

APIRoutes

Source

seyfert/src/components/componentcontext.ts:50


t

1
get t(): __InternalParseLocale<DefaultLocale> & Object

Gets the language object for the interaction’s locale.

Returns

__InternalParseLocale<DefaultLocale> & Object

Source

seyfert/src/components/componentcontext.ts:57

Methods

channel()

channel(mode)

1
channel(mode?: "rest" | "flow"): Promise<AllChannels>

Gets the channel of the interaction.

Parameters
ParameterTypeDescription
mode?"rest" | "flow"The mode to fetch the channel.
Returns

Promise<AllChannels>

A promise that resolves to the channel.

Source

seyfert/src/components/componentcontext.ts:126

channel(mode)

1
channel(mode?: "cache"): ReturnCache<AllChannels>
Parameters
ParameterType
mode?"cache"
Returns

ReturnCache<AllChannels>

Source

seyfert/src/components/componentcontext.ts:127


deferReply()

1
deferReply(ephemeral: boolean): Promise<void>

Defers the reply to the interaction.

Parameters

ParameterTypeDefault valueDescription
ephemeralbooleanfalseWhether the reply should be ephemeral or not.

Returns

Promise<void>

Source

seyfert/src/components/componentcontext.ts:81


deleteResponse()

1
deleteResponse(): Promise<undefined | void>

Deletes the response of the interaction.

Returns

Promise<undefined | void>

A promise that resolves when the response is deleted.

Source

seyfert/src/components/componentcontext.ts:117


editOrReply()

1
editOrReply<FR>(body: Omit<RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & ResolverProps | Omit<APIInteractionResponseCallbackData, "components" | "embeds" | "poll"> & SendResolverProps, fetchReply?: FR): Promise<When<FR, Message | WebhookMessage, void | Message | WebhookMessage>>

Edits the response or replies to the interaction.

Type parameters

Type parameterValue
FR extends booleanfalse

Parameters

ParameterTypeDescription
bodyOmit<RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & ResolverProps | Omit<APIInteractionResponseCallbackData, "components" | "embeds" | "poll"> & SendResolverPropsThe body of the response or updated body of the interaction.
fetchReply?FRWhether to fetch the reply or not.

Returns

Promise<When<FR, Message | WebhookMessage, void | Message | WebhookMessage>>

Source

seyfert/src/components/componentcontext.ts:106


editResponse()

1
editResponse(body: Omit<RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & ResolverProps): Promise<WebhookMessage>

Edits the response of the interaction.

Parameters

ParameterTypeDescription
bodyOmit<RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & ResolverPropsThe updated body of the response.

Returns

Promise<WebhookMessage>

Source

seyfert/src/components/componentcontext.ts:89


guild()

guild(mode)

1
guild(mode?: "rest" | "flow"): Promise<undefined | Guild<"cached" | "api">>

Gets the guild of the interaction.

Parameters
ParameterTypeDescription
mode?"rest" | "flow"The mode to fetch the guild.
Returns

Promise<undefined | Guild<"cached" | "api">>

A promise that resolves to the guild.

Source

seyfert/src/components/componentcontext.ts:157

guild(mode)

1
guild(mode?: "cache"): ReturnCache<undefined | Guild<"cached">>
Parameters
ParameterType
mode?"cache"
Returns

ReturnCache<undefined | Guild<"cached">>

Source

seyfert/src/components/componentcontext.ts:158


isChat()

1
isChat(): this is CommandContext<Object, never>

Returns

this is CommandContext<Object, never>

Inherited from

BaseContext.isChat

Source

seyfert/src/commands/basecontex.ts:14


isComponent()

1
isComponent(): this is ComponentContext<keyof ComponentCommandInteractionMap>

Returns

this is ComponentContext<keyof ComponentCommandInteractionMap>

Inherited from

BaseContext.isComponent

Source

seyfert/src/components/componentcontext.ts:200


isMenu()

1
isMenu(): this is MenuCommandContext<UserCommandInteraction<boolean> | MessageCommandInteraction<boolean>, never>

Returns

this is MenuCommandContext<UserCommandInteraction<boolean> | MessageCommandInteraction<boolean>, never>

Inherited from

BaseContext.isMenu

Source

seyfert/src/commands/basecontex.ts:18


isMenuMessage()

1
isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction<boolean>, never>

Returns

this is MenuCommandContext<MessageCommandInteraction<boolean>, never>

Inherited from

BaseContext.isMenuMessage

Source

seyfert/src/commands/basecontex.ts:26


isMenuUser()

1
isMenuUser(): this is MenuCommandContext<UserCommandInteraction<boolean>, never>

Returns

this is MenuCommandContext<UserCommandInteraction<boolean>, never>

Inherited from

BaseContext.isMenuUser

Source

seyfert/src/commands/basecontex.ts:22


me()

me(mode)

1
me(mode?: "rest" | "flow"): Promise<GuildMember>

Gets the bot member in the guild of the interaction.

Parameters
ParameterTypeDescription
mode?"rest" | "flow"The mode to fetch the member.
Returns

Promise<GuildMember>

A promise that resolves to the bot member.

Source

seyfert/src/components/componentcontext.ts:139

me(mode)

1
me(mode?: "cache"): ReturnCache<undefined | GuildMember>
Parameters
ParameterType
mode?"cache"
Returns

ReturnCache<undefined | GuildMember>

Source

seyfert/src/components/componentcontext.ts:140


update()

1
update(body: Omit<APIInteractionResponseCallbackData, "components" | "embeds"> & ResolverProps): Promise<void>

Updates the interaction with new data.

Parameters

ParameterTypeDescription
bodyOmit<APIInteractionResponseCallbackData, "components" | "embeds"> & ResolverPropsThe updated body of the interaction.

Returns

Promise<void>

Source

seyfert/src/components/componentcontext.ts:97


write()

1
write<FR>(body: Omit<APIInteractionResponseCallbackData, "components" | "embeds" | "poll"> & SendResolverProps, fetchReply?: FR): Promise<When<FR, WebhookMessage, void>>

Writes a response to the interaction.

Type parameters

Type parameterValue
FR extends booleanfalse

Parameters

ParameterTypeDescription
bodyOmit<APIInteractionResponseCallbackData, "components" | "embeds" | "poll"> & SendResolverPropsThe body of the response.
fetchReply?FRWhether to fetch the reply or not.

Returns

Promise<When<FR, WebhookMessage, void>>

Source

seyfert/src/components/componentcontext.ts:73