mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-09-17 08:47:24 +00:00
feat: Support select in modals (#1321)
This commit is contained in:
+20
-5
@@ -7,16 +7,31 @@ import type {
|
||||
InteractionType,
|
||||
} from '../mod.ts';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
export interface APIBaseModalSubmitComponent<T extends ComponentType> extends APIBaseComponent<T> {
|
||||
type: T;
|
||||
custom_id: string;
|
||||
}
|
||||
|
||||
export interface APIModalSubmitTextInputComponent extends APIBaseModalSubmitComponent<ComponentType.TextInput> {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
components: ModalSubmitComponent[];
|
||||
export interface APIModalSubmitStringSelectComponent extends APIBaseModalSubmitComponent<ComponentType.StringSelect> {
|
||||
values: string[];
|
||||
}
|
||||
|
||||
export type ModalSubmitComponent = APIModalSubmitStringSelectComponent | APIModalSubmitTextInputComponent;
|
||||
|
||||
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
components: APIModalSubmitTextInputComponent[];
|
||||
}
|
||||
|
||||
export interface ModalSubmitLabelComponent extends APIBaseComponent<ComponentType.Label> {
|
||||
component: ModalSubmitComponent;
|
||||
}
|
||||
|
||||
export type APIModalSubmissionComponent = ModalSubmitActionRowComponent | ModalSubmitLabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure}
|
||||
*/
|
||||
@@ -28,7 +43,7 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components: ModalSubmitActionRowComponent[];
|
||||
components: APIModalSubmissionComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+8
-2
@@ -1,5 +1,5 @@
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v10.ts';
|
||||
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel.ts';
|
||||
import type { APIActionRowComponent, APIComponentInModalActionRow, APILabelComponent } from '../channel.ts';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
|
||||
|
||||
/**
|
||||
@@ -126,6 +126,10 @@ export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
export type APIModalInteractionResponseCallbackComponent =
|
||||
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||
| APILabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal}
|
||||
*/
|
||||
@@ -140,6 +144,8 @@ export interface APIModalInteractionResponseCallbackData {
|
||||
title: string;
|
||||
/**
|
||||
* Between 1 and 5 (inclusive) components that make up the modal
|
||||
*
|
||||
* @remarks Using action rows inside modals is deprecated.
|
||||
*/
|
||||
components: APIActionRowComponent<APIComponentInModalActionRow>[];
|
||||
components: APIModalInteractionResponseCallbackComponent[];
|
||||
}
|
||||
|
||||
Generated
+48
-9
@@ -1705,7 +1705,10 @@ export enum ComponentType {
|
||||
* Container that visually groups a set of components
|
||||
*/
|
||||
Container,
|
||||
|
||||
/**
|
||||
* Container associating a label and description with a component
|
||||
*/
|
||||
Label,
|
||||
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
|
||||
|
||||
/**
|
||||
@@ -1717,7 +1720,7 @@ export enum ComponentType {
|
||||
}
|
||||
|
||||
/**
|
||||
* An Action Row is a top-level layout component used in messages and modals.
|
||||
* An Action Row is a top-level layout component used in messages. Use in modals is deprecated.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
*/
|
||||
@@ -1919,7 +1922,7 @@ export interface APIBaseAutoPopulatedSelectMenuComponent<
|
||||
*
|
||||
* String Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an interaction.
|
||||
*
|
||||
* String Selects must be placed inside an Action Row and are only available in messages. An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
|
||||
* An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#string-select}
|
||||
*/
|
||||
@@ -1928,6 +1931,10 @@ export interface APIStringSelectComponent extends APIBaseSelectMenuComponent<Com
|
||||
* Specified choices in a select menu; max 25
|
||||
*/
|
||||
options: APISelectMenuOption[];
|
||||
/**
|
||||
* Whether this component is required in modals.
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2052,9 +2059,9 @@ export interface APISelectMenuOption {
|
||||
}
|
||||
|
||||
/**
|
||||
* Text Input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
|
||||
* Text input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
|
||||
*
|
||||
* Text Inputs can only be used within modals and must be placed inside an Action Row.
|
||||
* Text inputs can only be used within modals.
|
||||
*
|
||||
* When defining a text input component, you can set attributes to customize the behavior and appearance of it. However, not all attributes will be returned in the text input interaction payload.
|
||||
*
|
||||
@@ -2070,9 +2077,11 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* Text that appears on top of the text input field, max 45 characters
|
||||
* Text that appears on top of the text input field, max 45 characters.
|
||||
*
|
||||
* @remarks Cannot be used in a label component.
|
||||
*/
|
||||
label: string;
|
||||
label?: string;
|
||||
/**
|
||||
* Placeholder for the text input
|
||||
*/
|
||||
@@ -2090,7 +2099,7 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
*/
|
||||
max_length?: number;
|
||||
/**
|
||||
* Whether or not this text input is required or not
|
||||
* Whether this text input is required
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
@@ -2305,6 +2314,26 @@ export interface APIContainerComponent extends APIBaseComponent<ComponentType.Co
|
||||
components: APIComponentInContainer[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A Label is a top-level layout component. Labels wrap modal components with text as a label and optional description.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#label}
|
||||
*/
|
||||
export interface APILabelComponent extends APIBaseComponent<ComponentType.Label> {
|
||||
/**
|
||||
* The label text; max 45 characters
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* An optional description text for the label; max 100 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* The component within the label
|
||||
*/
|
||||
component: APIComponentInLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#message-snapshot-object}
|
||||
*/
|
||||
@@ -2403,7 +2432,11 @@ export type APIMessageTopLevelComponent =
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference}
|
||||
*/
|
||||
export type APIModalComponent = APIActionRowComponent<APIComponentInModalActionRow> | APIComponentInModalActionRow;
|
||||
export type APIModalComponent =
|
||||
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||
| APIComponentInLabel
|
||||
| APIComponentInModalActionRow
|
||||
| APILabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
@@ -2417,9 +2450,15 @@ export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuC
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
* @deprecated
|
||||
*/
|
||||
export type APIComponentInModalActionRow = APITextInputComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#label-label-child-components}
|
||||
*/
|
||||
export type APIComponentInLabel = APIStringSelectComponent | APITextInputComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#section}
|
||||
*/
|
||||
|
||||
+20
-5
@@ -7,16 +7,31 @@ import type {
|
||||
InteractionType,
|
||||
} from '../mod.ts';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
export interface APIBaseModalSubmitComponent<T extends ComponentType> extends APIBaseComponent<T> {
|
||||
type: T;
|
||||
custom_id: string;
|
||||
}
|
||||
|
||||
export interface APIModalSubmitTextInputComponent extends APIBaseModalSubmitComponent<ComponentType.TextInput> {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
components: ModalSubmitComponent[];
|
||||
export interface APIModalSubmitStringSelectComponent extends APIBaseModalSubmitComponent<ComponentType.StringSelect> {
|
||||
values: string[];
|
||||
}
|
||||
|
||||
export type ModalSubmitComponent = APIModalSubmitStringSelectComponent | APIModalSubmitTextInputComponent;
|
||||
|
||||
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
components: APIModalSubmitTextInputComponent[];
|
||||
}
|
||||
|
||||
export interface ModalSubmitLabelComponent extends APIBaseComponent<ComponentType.Label> {
|
||||
component: ModalSubmitComponent;
|
||||
}
|
||||
|
||||
export type APIModalSubmissionComponent = ModalSubmitActionRowComponent | ModalSubmitLabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure}
|
||||
*/
|
||||
@@ -28,7 +43,7 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components: ModalSubmitActionRowComponent[];
|
||||
components: APIModalSubmissionComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+8
-2
@@ -1,5 +1,5 @@
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
|
||||
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel.ts';
|
||||
import type { APIActionRowComponent, APIComponentInModalActionRow, APILabelComponent } from '../channel.ts';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
|
||||
|
||||
/**
|
||||
@@ -126,6 +126,10 @@ export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
export type APIModalInteractionResponseCallbackComponent =
|
||||
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||
| APILabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal}
|
||||
*/
|
||||
@@ -140,6 +144,8 @@ export interface APIModalInteractionResponseCallbackData {
|
||||
title: string;
|
||||
/**
|
||||
* Between 1 and 5 (inclusive) components that make up the modal
|
||||
*
|
||||
* @remarks Using action rows inside modals is deprecated.
|
||||
*/
|
||||
components: APIActionRowComponent<APIComponentInModalActionRow>[];
|
||||
components: APIModalInteractionResponseCallbackComponent[];
|
||||
}
|
||||
|
||||
Generated
+49
-8
@@ -1704,7 +1704,10 @@ export enum ComponentType {
|
||||
* Container that visually groups a set of components
|
||||
*/
|
||||
Container,
|
||||
|
||||
/**
|
||||
* Container associating a label and description with a component
|
||||
*/
|
||||
Label,
|
||||
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
|
||||
|
||||
/**
|
||||
@@ -1716,6 +1719,8 @@ export enum ComponentType {
|
||||
}
|
||||
|
||||
/**
|
||||
* An Action Row is a top-level layout component used in messages. Use in modals is deprecated.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
*/
|
||||
export interface APIActionRowComponent<T extends APIComponentInActionRow>
|
||||
@@ -1916,7 +1921,7 @@ export interface APIBaseAutoPopulatedSelectMenuComponent<
|
||||
*
|
||||
* String Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an interaction.
|
||||
*
|
||||
* String Selects must be placed inside an Action Row and are only available in messages. An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
|
||||
* An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#string-select}
|
||||
*/
|
||||
@@ -1925,6 +1930,10 @@ export interface APIStringSelectComponent extends APIBaseSelectMenuComponent<Com
|
||||
* Specified choices in a select menu; max 25
|
||||
*/
|
||||
options: APISelectMenuOption[];
|
||||
/**
|
||||
* Whether this component is required in modals.
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2049,9 +2058,9 @@ export interface APISelectMenuOption {
|
||||
}
|
||||
|
||||
/**
|
||||
* Text Input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
|
||||
* Text input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
|
||||
*
|
||||
* Text Inputs can only be used within modals and must be placed inside an Action Row.
|
||||
* Text inputs can only be used within modals.
|
||||
*
|
||||
* When defining a text input component, you can set attributes to customize the behavior and appearance of it. However, not all attributes will be returned in the text input interaction payload.
|
||||
*
|
||||
@@ -2067,9 +2076,11 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* Text that appears on top of the text input field, max 45 characters
|
||||
* Text that appears on top of the text input field, max 45 characters.
|
||||
*
|
||||
* @remarks Cannot be used in a label component.
|
||||
*/
|
||||
label: string;
|
||||
label?: string;
|
||||
/**
|
||||
* Placeholder for the text input
|
||||
*/
|
||||
@@ -2087,7 +2098,7 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
*/
|
||||
max_length?: number;
|
||||
/**
|
||||
* Whether or not this text input is required or not
|
||||
* Whether this text input is required
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
@@ -2302,6 +2313,26 @@ export interface APIContainerComponent extends APIBaseComponent<ComponentType.Co
|
||||
components: APIComponentInContainer[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A Label is a top-level layout component. Labels wrap modal components with text as a label and optional description.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#label}
|
||||
*/
|
||||
export interface APILabelComponent extends APIBaseComponent<ComponentType.Label> {
|
||||
/**
|
||||
* The label text; max 45 characters
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* An optional description text for the label; max 100 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* The component within the label
|
||||
*/
|
||||
component: APIComponentInLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#message-snapshot-object}
|
||||
*/
|
||||
@@ -2400,7 +2431,11 @@ export type APIMessageTopLevelComponent =
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference}
|
||||
*/
|
||||
export type APIModalComponent = APIActionRowComponent<APIComponentInModalActionRow> | APIComponentInModalActionRow;
|
||||
export type APIModalComponent =
|
||||
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||
| APIComponentInLabel
|
||||
| APIComponentInModalActionRow
|
||||
| APILabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
@@ -2414,9 +2449,15 @@ export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuC
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
* @deprecated
|
||||
*/
|
||||
export type APIComponentInModalActionRow = APITextInputComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#label-label-child-components}
|
||||
*/
|
||||
export type APIComponentInLabel = APIStringSelectComponent | APITextInputComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#section}
|
||||
*/
|
||||
|
||||
@@ -7,16 +7,31 @@ import type {
|
||||
InteractionType,
|
||||
} from '../index';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
export interface APIBaseModalSubmitComponent<T extends ComponentType> extends APIBaseComponent<T> {
|
||||
type: T;
|
||||
custom_id: string;
|
||||
}
|
||||
|
||||
export interface APIModalSubmitTextInputComponent extends APIBaseModalSubmitComponent<ComponentType.TextInput> {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
components: ModalSubmitComponent[];
|
||||
export interface APIModalSubmitStringSelectComponent extends APIBaseModalSubmitComponent<ComponentType.StringSelect> {
|
||||
values: string[];
|
||||
}
|
||||
|
||||
export type ModalSubmitComponent = APIModalSubmitStringSelectComponent | APIModalSubmitTextInputComponent;
|
||||
|
||||
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
components: APIModalSubmitTextInputComponent[];
|
||||
}
|
||||
|
||||
export interface ModalSubmitLabelComponent extends APIBaseComponent<ComponentType.Label> {
|
||||
component: ModalSubmitComponent;
|
||||
}
|
||||
|
||||
export type APIModalSubmissionComponent = ModalSubmitActionRowComponent | ModalSubmitLabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure}
|
||||
*/
|
||||
@@ -28,7 +43,7 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components: ModalSubmitActionRowComponent[];
|
||||
components: APIModalSubmissionComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v10';
|
||||
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel';
|
||||
import type { APIActionRowComponent, APIComponentInModalActionRow, APILabelComponent } from '../channel';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
|
||||
|
||||
/**
|
||||
@@ -126,6 +126,10 @@ export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
export type APIModalInteractionResponseCallbackComponent =
|
||||
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||
| APILabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal}
|
||||
*/
|
||||
@@ -140,6 +144,8 @@ export interface APIModalInteractionResponseCallbackData {
|
||||
title: string;
|
||||
/**
|
||||
* Between 1 and 5 (inclusive) components that make up the modal
|
||||
*
|
||||
* @remarks Using action rows inside modals is deprecated.
|
||||
*/
|
||||
components: APIActionRowComponent<APIComponentInModalActionRow>[];
|
||||
components: APIModalInteractionResponseCallbackComponent[];
|
||||
}
|
||||
|
||||
+48
-9
@@ -1705,7 +1705,10 @@ export enum ComponentType {
|
||||
* Container that visually groups a set of components
|
||||
*/
|
||||
Container,
|
||||
|
||||
/**
|
||||
* Container associating a label and description with a component
|
||||
*/
|
||||
Label,
|
||||
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
|
||||
|
||||
/**
|
||||
@@ -1717,7 +1720,7 @@ export enum ComponentType {
|
||||
}
|
||||
|
||||
/**
|
||||
* An Action Row is a top-level layout component used in messages and modals.
|
||||
* An Action Row is a top-level layout component used in messages. Use in modals is deprecated.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
*/
|
||||
@@ -1919,7 +1922,7 @@ export interface APIBaseAutoPopulatedSelectMenuComponent<
|
||||
*
|
||||
* String Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an interaction.
|
||||
*
|
||||
* String Selects must be placed inside an Action Row and are only available in messages. An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
|
||||
* An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#string-select}
|
||||
*/
|
||||
@@ -1928,6 +1931,10 @@ export interface APIStringSelectComponent extends APIBaseSelectMenuComponent<Com
|
||||
* Specified choices in a select menu; max 25
|
||||
*/
|
||||
options: APISelectMenuOption[];
|
||||
/**
|
||||
* Whether this component is required in modals.
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2052,9 +2059,9 @@ export interface APISelectMenuOption {
|
||||
}
|
||||
|
||||
/**
|
||||
* Text Input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
|
||||
* Text input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
|
||||
*
|
||||
* Text Inputs can only be used within modals and must be placed inside an Action Row.
|
||||
* Text inputs can only be used within modals.
|
||||
*
|
||||
* When defining a text input component, you can set attributes to customize the behavior and appearance of it. However, not all attributes will be returned in the text input interaction payload.
|
||||
*
|
||||
@@ -2070,9 +2077,11 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* Text that appears on top of the text input field, max 45 characters
|
||||
* Text that appears on top of the text input field, max 45 characters.
|
||||
*
|
||||
* @remarks Cannot be used in a label component.
|
||||
*/
|
||||
label: string;
|
||||
label?: string;
|
||||
/**
|
||||
* Placeholder for the text input
|
||||
*/
|
||||
@@ -2090,7 +2099,7 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
*/
|
||||
max_length?: number;
|
||||
/**
|
||||
* Whether or not this text input is required or not
|
||||
* Whether this text input is required
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
@@ -2305,6 +2314,26 @@ export interface APIContainerComponent extends APIBaseComponent<ComponentType.Co
|
||||
components: APIComponentInContainer[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A Label is a top-level layout component. Labels wrap modal components with text as a label and optional description.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#label}
|
||||
*/
|
||||
export interface APILabelComponent extends APIBaseComponent<ComponentType.Label> {
|
||||
/**
|
||||
* The label text; max 45 characters
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* An optional description text for the label; max 100 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* The component within the label
|
||||
*/
|
||||
component: APIComponentInLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#message-snapshot-object}
|
||||
*/
|
||||
@@ -2403,7 +2432,11 @@ export type APIMessageTopLevelComponent =
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference}
|
||||
*/
|
||||
export type APIModalComponent = APIActionRowComponent<APIComponentInModalActionRow> | APIComponentInModalActionRow;
|
||||
export type APIModalComponent =
|
||||
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||
| APIComponentInLabel
|
||||
| APIComponentInModalActionRow
|
||||
| APILabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
@@ -2417,9 +2450,15 @@ export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuC
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
* @deprecated
|
||||
*/
|
||||
export type APIComponentInModalActionRow = APITextInputComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#label-label-child-components}
|
||||
*/
|
||||
export type APIComponentInLabel = APIStringSelectComponent | APITextInputComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#section}
|
||||
*/
|
||||
|
||||
@@ -7,16 +7,31 @@ import type {
|
||||
InteractionType,
|
||||
} from '../index';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
export interface APIBaseModalSubmitComponent<T extends ComponentType> extends APIBaseComponent<T> {
|
||||
type: T;
|
||||
custom_id: string;
|
||||
}
|
||||
|
||||
export interface APIModalSubmitTextInputComponent extends APIBaseModalSubmitComponent<ComponentType.TextInput> {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
components: ModalSubmitComponent[];
|
||||
export interface APIModalSubmitStringSelectComponent extends APIBaseModalSubmitComponent<ComponentType.StringSelect> {
|
||||
values: string[];
|
||||
}
|
||||
|
||||
export type ModalSubmitComponent = APIModalSubmitStringSelectComponent | APIModalSubmitTextInputComponent;
|
||||
|
||||
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
components: APIModalSubmitTextInputComponent[];
|
||||
}
|
||||
|
||||
export interface ModalSubmitLabelComponent extends APIBaseComponent<ComponentType.Label> {
|
||||
component: ModalSubmitComponent;
|
||||
}
|
||||
|
||||
export type APIModalSubmissionComponent = ModalSubmitActionRowComponent | ModalSubmitLabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure}
|
||||
*/
|
||||
@@ -28,7 +43,7 @@ export interface APIModalSubmission {
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components: ModalSubmitActionRowComponent[];
|
||||
components: APIModalSubmissionComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9';
|
||||
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel';
|
||||
import type { APIActionRowComponent, APIComponentInModalActionRow, APILabelComponent } from '../channel';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
|
||||
|
||||
/**
|
||||
@@ -126,6 +126,10 @@ export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
export type APIModalInteractionResponseCallbackComponent =
|
||||
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||
| APILabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal}
|
||||
*/
|
||||
@@ -140,6 +144,8 @@ export interface APIModalInteractionResponseCallbackData {
|
||||
title: string;
|
||||
/**
|
||||
* Between 1 and 5 (inclusive) components that make up the modal
|
||||
*
|
||||
* @remarks Using action rows inside modals is deprecated.
|
||||
*/
|
||||
components: APIActionRowComponent<APIComponentInModalActionRow>[];
|
||||
components: APIModalInteractionResponseCallbackComponent[];
|
||||
}
|
||||
|
||||
+49
-8
@@ -1704,7 +1704,10 @@ export enum ComponentType {
|
||||
* Container that visually groups a set of components
|
||||
*/
|
||||
Container,
|
||||
|
||||
/**
|
||||
* Container associating a label and description with a component
|
||||
*/
|
||||
Label,
|
||||
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
|
||||
|
||||
/**
|
||||
@@ -1716,6 +1719,8 @@ export enum ComponentType {
|
||||
}
|
||||
|
||||
/**
|
||||
* An Action Row is a top-level layout component used in messages. Use in modals is deprecated.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
*/
|
||||
export interface APIActionRowComponent<T extends APIComponentInActionRow>
|
||||
@@ -1916,7 +1921,7 @@ export interface APIBaseAutoPopulatedSelectMenuComponent<
|
||||
*
|
||||
* String Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an interaction.
|
||||
*
|
||||
* String Selects must be placed inside an Action Row and are only available in messages. An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
|
||||
* An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#string-select}
|
||||
*/
|
||||
@@ -1925,6 +1930,10 @@ export interface APIStringSelectComponent extends APIBaseSelectMenuComponent<Com
|
||||
* Specified choices in a select menu; max 25
|
||||
*/
|
||||
options: APISelectMenuOption[];
|
||||
/**
|
||||
* Whether this component is required in modals.
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2049,9 +2058,9 @@ export interface APISelectMenuOption {
|
||||
}
|
||||
|
||||
/**
|
||||
* Text Input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
|
||||
* Text input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
|
||||
*
|
||||
* Text Inputs can only be used within modals and must be placed inside an Action Row.
|
||||
* Text inputs can only be used within modals.
|
||||
*
|
||||
* When defining a text input component, you can set attributes to customize the behavior and appearance of it. However, not all attributes will be returned in the text input interaction payload.
|
||||
*
|
||||
@@ -2067,9 +2076,11 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* Text that appears on top of the text input field, max 45 characters
|
||||
* Text that appears on top of the text input field, max 45 characters.
|
||||
*
|
||||
* @remarks Cannot be used in a label component.
|
||||
*/
|
||||
label: string;
|
||||
label?: string;
|
||||
/**
|
||||
* Placeholder for the text input
|
||||
*/
|
||||
@@ -2087,7 +2098,7 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
|
||||
*/
|
||||
max_length?: number;
|
||||
/**
|
||||
* Whether or not this text input is required or not
|
||||
* Whether this text input is required
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
@@ -2302,6 +2313,26 @@ export interface APIContainerComponent extends APIBaseComponent<ComponentType.Co
|
||||
components: APIComponentInContainer[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A Label is a top-level layout component. Labels wrap modal components with text as a label and optional description.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#label}
|
||||
*/
|
||||
export interface APILabelComponent extends APIBaseComponent<ComponentType.Label> {
|
||||
/**
|
||||
* The label text; max 45 characters
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* An optional description text for the label; max 100 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* The component within the label
|
||||
*/
|
||||
component: APIComponentInLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#message-snapshot-object}
|
||||
*/
|
||||
@@ -2400,7 +2431,11 @@ export type APIMessageTopLevelComponent =
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference}
|
||||
*/
|
||||
export type APIModalComponent = APIActionRowComponent<APIComponentInModalActionRow> | APIComponentInModalActionRow;
|
||||
export type APIModalComponent =
|
||||
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||
| APIComponentInLabel
|
||||
| APIComponentInModalActionRow
|
||||
| APILabelComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
@@ -2414,9 +2449,15 @@ export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuC
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
|
||||
* @deprecated
|
||||
*/
|
||||
export type APIComponentInModalActionRow = APITextInputComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#label-label-child-components}
|
||||
*/
|
||||
export type APIComponentInLabel = APIStringSelectComponent | APITextInputComponent;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/components/reference#section}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user