ComponentContext
Represents a context for interacting with components in a Discord bot.
Extends
BaseContext
.ExtendContext
Type parameters
Type parameter | Description |
---|---|
Type extends keyof ComponentCommandInteractionMap | The type of component interaction. |
Constructors
new ComponentContext(client, interaction)
Creates a new instance of the ComponentContext class.
Parameters
Parameter | Type | Description |
---|---|---|
client | UsingClient | The UsingClient instance. |
interaction | ComponentInteraction <boolean , APIMessageComponentInteraction > | ComponentCommandInteractionMap [Type ] | The component interaction object. |
Returns
ComponentContext
<Type
>
Inherited from
BaseContext.constructor
Source
seyfert/src/components/componentcontext.ts:40
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
client | readonly | UsingClient | The UsingClient instance. | BaseContext.client |
interaction | public | ComponentInteraction <boolean , APIMessageComponentInteraction > | ComponentCommandInteractionMap [Type ] | The component interaction object. | - |
Accessors
author
Gets the author of the interaction.
Returns
Source
seyfert/src/components/componentcontext.ts:189
channelId
Gets the ID of the channel of the interaction.
Returns
string
Source
seyfert/src/components/componentcontext.ts:182
customId
Gets the custom ID of the interaction.
Returns
string
Source
seyfert/src/components/componentcontext.ts:64
guildId
Gets the ID of the guild of the interaction.
Returns
undefined
| string
Source
seyfert/src/components/componentcontext.ts:175
member
Gets the member of the interaction.
Returns
undefined
| InteractionGuildMember
Source
seyfert/src/components/componentcontext.ts:196
proxy
Gets the proxy object.
Returns
Source
seyfert/src/components/componentcontext.ts:50
t
Gets the language object for the interaction’s locale.
Returns
__InternalParseLocale
<DefaultLocale
> & Object
Source
seyfert/src/components/componentcontext.ts:57
Methods
channel()
channel(mode)
Gets the channel of the interaction.
Parameters
Parameter | Type | Description |
---|---|---|
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)
Parameters
Parameter | Type |
---|---|
mode ? | "cache" |
Returns
Source
seyfert/src/components/componentcontext.ts:127
deferReply()
Defers the reply to the interaction.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
ephemeral | boolean | false | Whether the reply should be ephemeral or not. |
Returns
Promise
<void
>
Source
seyfert/src/components/componentcontext.ts:81
deleteResponse()
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()
Edits the response or replies to the interaction.
Type parameters
Type parameter | Value |
---|---|
FR extends boolean | false |
Parameters
Parameter | Type | Description |
---|---|---|
body | Omit <RESTPatchAPIWebhookWithTokenMessageJSONBody , "components" | "embeds" > & ResolverProps | Omit <APIInteractionResponseCallbackData , "components" | "embeds" | "poll" > & SendResolverProps | The body of the response or updated body of the interaction. |
fetchReply ? | FR | Whether to fetch the reply or not. |
Returns
Promise
<When
<FR
, Message
| WebhookMessage
, void
| Message
| WebhookMessage
>>
Source
seyfert/src/components/componentcontext.ts:106
editResponse()
Edits the response of the interaction.
Parameters
Parameter | Type | Description |
---|---|---|
body | Omit <RESTPatchAPIWebhookWithTokenMessageJSONBody , "components" | "embeds" > & ResolverProps | The updated body of the response. |
Returns
Promise
<WebhookMessage
>
Source
seyfert/src/components/componentcontext.ts:89
guild()
guild(mode)
Gets the guild of the interaction.
Parameters
Parameter | Type | Description |
---|---|---|
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)
Parameters
Parameter | Type |
---|---|
mode ? | "cache" |
Returns
ReturnCache
<undefined
| Guild
<"cached"
>>
Source
seyfert/src/components/componentcontext.ts:158
isChat()
Returns
this is CommandContext<Object, never>
Inherited from
BaseContext.isChat
Source
seyfert/src/commands/basecontex.ts:14
isComponent()
Returns
this is ComponentContext<keyof ComponentCommandInteractionMap>
Inherited from
BaseContext.isComponent
Source
seyfert/src/components/componentcontext.ts:200
isMenu()
Returns
this is MenuCommandContext<UserCommandInteraction<boolean> | MessageCommandInteraction<boolean>, never>
Inherited from
BaseContext.isMenu
Source
seyfert/src/commands/basecontex.ts:18
isMenuMessage()
Returns
this is MenuCommandContext<MessageCommandInteraction<boolean>, never>
Inherited from
BaseContext.isMenuMessage
Source
seyfert/src/commands/basecontex.ts:26
isMenuUser()
Returns
this is MenuCommandContext<UserCommandInteraction<boolean>, never>
Inherited from
BaseContext.isMenuUser
Source
seyfert/src/commands/basecontex.ts:22
me()
me(mode)
Gets the bot member in the guild of the interaction.
Parameters
Parameter | Type | Description |
---|---|---|
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)
Parameters
Parameter | Type |
---|---|
mode ? | "cache" |
Returns
ReturnCache
<undefined
| GuildMember
>
Source
seyfert/src/components/componentcontext.ts:140
update()
Updates the interaction with new data.
Parameters
Parameter | Type | Description |
---|---|---|
body | Omit <APIInteractionResponseCallbackData , "components" | "embeds" > & ResolverProps | The updated body of the interaction. |
Returns
Promise
<void
>
Source
seyfert/src/components/componentcontext.ts:97
write()
Writes a response to the interaction.
Type parameters
Type parameter | Value |
---|---|
FR extends boolean | false |
Parameters
Parameter | Type | Description |
---|---|---|
body | Omit <APIInteractionResponseCallbackData , "components" | "embeds" | "poll" > & SendResolverProps | The body of the response. |
fetchReply ? | FR | Whether to fetch the reply or not. |
Returns
Promise
<When
<FR
, WebhookMessage
, void
>>