BaseContext
↳ CommandContext
client
, data
): CommandContext
Constructs a new instance of the APIApplicationCommandInteractionData class.
Name | Type | Description |
---|---|---|
client | YorClient | The client object. |
data | APIChatInputApplicationCommandInteraction | The data used to initialize the instance. |
CommandContext
Private
API: YorClientAPI
Readonly
applicationId: string
Channel
YorClient
Readonly
interactionId: string
undefined
| Member
Readonly
raw: APIChatInputApplicationCommandInteraction
Optional
subcommand: APIApplicationCommandInteractionDataSubcommandOption
Optional
subcommandGroup: APIApplicationCommandInteractionDataSubcommandGroupOption
Readonly
token: string
undefined
| User
name
, data
): unknown
Decorates the object with a new property.
Name | Type | Description |
---|---|---|
name | string | The name of the property. |
data | unknown | The data to assign to the property. |
unknown
The decorated object.
ephemeral?
): Promise
<void
>
Defers the execution of the function.
Name | Type | Default value | Description |
---|---|---|---|
ephemeral | boolean | false | Whether the message is ephemeral or not. |
Promise
<void
>
A promise that resolves when the deferral is complete.
Promise
<void
>
Deletes a reply.
Promise
<void
>
A promise that resolves when the reply is deleted.
data
): Promise
<APIMessage
>
Edits a reply.
Name | Type | Description |
---|---|---|
data | Omit <RESTPostAPIWebhookWithTokenJSONBody , "username" | "avatar_url" > & { flags? : MessageFlags } & { files? : RawFile [] } | The data for editing the reply. |
Promise
<APIMessage
>
A promise that resolves when the reply is edited.
Promise
<APIMessage
>
Fetches the reply asynchronously.
Promise
<APIMessage
>
A promise that resolves when the original reply is fetched.
data
): Promise
<APIMessage
>
Calls the followUp method of the API class with the provided data.
Name | Type | Description |
---|---|---|
data | Omit <RESTPostAPIWebhookWithTokenJSONBody , "username" | "avatar_url" > & { flags? : MessageFlags } & { files? : RawFile [] } | The data to be passed to the followUp method. |
Promise
<APIMessage
>
A promise that resolves to an APIMessage object.
T
>(name
, index?
, required?
): T
extends true
? APIAttachment
: null
| APIAttachment
Retrieves the value of the attachment option from the interaction data.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the attachment option. |
index | 0 | 2 | 1 | 0 | The index of the attachment option. |
required? | T | undefined | Whether the attachment option is required. |
T
extends true
? APIAttachment
: null
| APIAttachment
The value of the attachment option, or null if it doesn’t exist.
Throws
If the attachment option is required but doesn’t exist.
T
>(name
, index?
, required?
): T
extends true
? boolean
: null
| boolean
Retrieves a boolean option from the command’s options.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the option to retrieve. |
index | 0 | 2 | 1 | 0 | (Optional) The index of the option to retrieve. Defaults to 0. |
required? | T | undefined | (Optional) Specifies if the option is required. Defaults to false. |
T
extends true
? boolean
: null
| boolean
T
>(name
, index?
, required?
): T
extends true
? Channel
: null
| Channel
Retrieves a channel option from the command’s options.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the option to retrieve. |
index | 0 | 2 | 1 | 0 | (Optional) The index of the option to retrieve. Defaults to 0. |
required? | T | undefined | (Optional) Specifies if the option is required. Defaults to false. |
T
extends true
? Channel
: null
| Channel
T
>(name
, index?
, required?
): T
extends true
? number
: null
| number
Retrieves an integer option from the API.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the option. |
index | 0 | 2 | 1 | 0 | The index of the option. |
required? | T | undefined | Whether the option is required or not. |
T
extends true
? number
: null
| number
T
>(name
, index?
, required?
): T
extends true
? Member
: null
| Member
Retrieves a user option from the command’s options.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the option to retrieve. |
index | 0 | 2 | 1 | 0 | (Optional) The index of the option to retrieve. Defaults to 0. |
required? | T | undefined | (Optional) Specifies if the option is required. Defaults to false. |
T
extends true
? Member
: null
| Member
T
>(name
, index?
, required?
): T
extends true
? number
: null
| number
Retrieves a number option from the command’s options.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the option to retrieve. |
index | 0 | 2 | 1 | 0 | (Optional) The index of the option to retrieve. Defaults to 0. |
required? | T | undefined | (Optional) Specifies if the option is required. Defaults to false. |
T
extends true
? number
: null
| number
T
>(name
, index?
, required?
): T
extends true
? Role
: null
| Role
Retrieves a role option from the command’s options.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the option to retrieve. |
index | 0 | 2 | 1 | 0 | (Optional) The index of the option to retrieve. Defaults to 0. |
required? | T | undefined | (Optional) Specifies if the option is required. Defaults to false. |
T
extends true
? Role
: null
| Role
T
>(name
, index?
, required?
): T
extends true
? string
: null
| string
Retrieves a string option from the command’s options.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the option to retrieve. |
index | 0 | 2 | 1 | 0 | (Optional) The index of the option to retrieve. Defaults to 0. |
required? | T | undefined | (Optional) Specifies if the option is required. Defaults to false. |
T
extends true
? string
: null
| string
T
>(name
, index?
, required?
): T
extends true
? User
: null
| User
Retrieves a user option from the command’s options.
Name | Type |
---|---|
T | extends boolean |
Name | Type | Default value | Description |
---|---|---|---|
name | string | undefined | The name of the option to retrieve. |
index | 0 | 2 | 1 | 0 | (Optional) The index of the option to retrieve. Defaults to 0. |
required? | T | undefined | (Optional) Specifies if the option is required. Defaults to false. |
T
extends true
? User
: null
| User
boolean
Checks if the instance is in a guild.
boolean
Returns true if the instance is in a guild, otherwise false.
data
): Promise
<void
>
Replies to an interaction.
Name | Type | Description |
---|---|---|
data | Omit <RESTPostAPIWebhookWithTokenJSONBody , "username" | "avatar_url" > & { flags? : MessageFlags } & { files? : RawFile [] } | The data for creating the reply. |
Promise
<void
>
A promise that resolves when the reply is sent.
data
): Promise
<void
>
Reply to a modal.
Name | Type | Description |
---|---|---|
data | APIModalInteractionResponseCallbackData | The data for creating the modal. |
Promise
<void
>
A promise that resolves when the modal is created.