discord.js 15.0.0-dev.1757505703-f1bcff46b → 15.0.0-dev.1757808111-126529f46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/index.js +1 -0
- package/src/structures/LabelComponent.js +54 -0
- package/src/structures/ModalSubmitFields.js +21 -2
- package/src/structures/ModalSubmitInteraction.js +53 -14
- package/src/structures/interfaces/InteractionResponses.js +0 -7
- package/src/util/Components.js +31 -1
- package/typings/index.d.mts +50 -24
- package/typings/index.d.ts +50 -24
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "discord.js",
|
|
4
|
-
"version": "15.0.0-dev.
|
|
4
|
+
"version": "15.0.0-dev.1757808111-126529f46",
|
|
5
5
|
"description": "A powerful library for interacting with the Discord API",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"types": "./typings/index.d.ts",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"magic-bytes.js": "^1.12.1",
|
|
62
62
|
"tslib": "^2.8.1",
|
|
63
63
|
"undici": "7.11.0",
|
|
64
|
-
"@discordjs/
|
|
65
|
-
"@discordjs/
|
|
66
|
-
"@discordjs/rest": "^3.0.0-dev.
|
|
67
|
-
"@discordjs/util": "^2.0.0-dev.
|
|
68
|
-
"@discordjs/
|
|
69
|
-
"@discordjs/ws": "^3.0.0-dev.
|
|
64
|
+
"@discordjs/formatters": "^1.0.0-dev.1757808111-126529f46",
|
|
65
|
+
"@discordjs/builders": "^2.0.0-dev.1757808111-126529f46",
|
|
66
|
+
"@discordjs/rest": "^3.0.0-dev.1757808111-126529f46",
|
|
67
|
+
"@discordjs/util": "^2.0.0-dev.1757808111-126529f46",
|
|
68
|
+
"@discordjs/collection": "^3.0.0-dev.1757808111-126529f46",
|
|
69
|
+
"@discordjs/ws": "^3.0.0-dev.1757808111-126529f46"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@favware/cliff-jumper": "^4.1.0",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"turbo": "^2.5.6",
|
|
84
84
|
"typescript": "~5.9.2",
|
|
85
85
|
"@discordjs/api-extractor": "^7.52.7",
|
|
86
|
-
"@discordjs/
|
|
87
|
-
"@discordjs/
|
|
86
|
+
"@discordjs/scripts": "^0.1.0",
|
|
87
|
+
"@discordjs/docgen": "^0.12.1"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=22.12.0"
|
package/src/index.js
CHANGED
|
@@ -180,6 +180,7 @@ exports.InteractionCallbackResponse =
|
|
|
180
180
|
exports.InteractionCollector = require('./structures/InteractionCollector.js').InteractionCollector;
|
|
181
181
|
exports.InteractionWebhook = require('./structures/InteractionWebhook.js').InteractionWebhook;
|
|
182
182
|
exports.InviteGuild = require('./structures/InviteGuild.js').InviteGuild;
|
|
183
|
+
exports.LabelComponent = require('./structures/LabelComponent.js').LabelComponent;
|
|
183
184
|
exports.MediaChannel = require('./structures/MediaChannel.js').MediaChannel;
|
|
184
185
|
exports.MediaGalleryComponent = require('./structures/MediaGalleryComponent.js').MediaGalleryComponent;
|
|
185
186
|
exports.MediaGalleryItem = require('./structures/MediaGalleryItem.js').MediaGalleryItem;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { createComponent } = require('../util/Components.js');
|
|
4
|
+
const { Component } = require('./Component.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a label component
|
|
8
|
+
*
|
|
9
|
+
* @extends {Component}
|
|
10
|
+
*/
|
|
11
|
+
class LabelComponent extends Component {
|
|
12
|
+
constructor({ component, ...data }) {
|
|
13
|
+
super(data);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The component in this label
|
|
17
|
+
*
|
|
18
|
+
* @type {Component}
|
|
19
|
+
* @readonly
|
|
20
|
+
*/
|
|
21
|
+
this.component = createComponent(component);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The label of the component
|
|
26
|
+
*
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @readonly
|
|
29
|
+
*/
|
|
30
|
+
get label() {
|
|
31
|
+
return this.data.label;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The description of this component
|
|
36
|
+
*
|
|
37
|
+
* @type {?string}
|
|
38
|
+
* @readonly
|
|
39
|
+
*/
|
|
40
|
+
get description() {
|
|
41
|
+
return this.data.description ?? null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns the API-compatible JSON for this component
|
|
46
|
+
*
|
|
47
|
+
* @returns {APILabelComponent}
|
|
48
|
+
*/
|
|
49
|
+
toJSON() {
|
|
50
|
+
return { ...this.data, component: this.component.toJSON() };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
exports.LabelComponent = LabelComponent;
|
|
@@ -12,7 +12,7 @@ class ModalSubmitFields {
|
|
|
12
12
|
/**
|
|
13
13
|
* The components within the modal
|
|
14
14
|
*
|
|
15
|
-
* @type {ActionRowModalData
|
|
15
|
+
* @type {Array<ActionRowModalData | LabelModalData>}
|
|
16
16
|
*/
|
|
17
17
|
this.components = components;
|
|
18
18
|
|
|
@@ -22,7 +22,16 @@ class ModalSubmitFields {
|
|
|
22
22
|
* @type {Collection<string, ModalData>}
|
|
23
23
|
*/
|
|
24
24
|
this.fields = components.reduce((accumulator, next) => {
|
|
25
|
-
for
|
|
25
|
+
// NOTE: for legacy support of action rows in modals, which has `components`
|
|
26
|
+
if ('components' in next) {
|
|
27
|
+
for (const component of next.components) accumulator.set(component.customId, component);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// For label component
|
|
31
|
+
if ('component' in next) {
|
|
32
|
+
accumulator.set(next.component.customId, next.component);
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
return accumulator;
|
|
27
36
|
}, new Collection());
|
|
28
37
|
}
|
|
@@ -54,6 +63,16 @@ class ModalSubmitFields {
|
|
|
54
63
|
getTextInputValue(customId) {
|
|
55
64
|
return this.getField(customId, ComponentType.TextInput).value;
|
|
56
65
|
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Gets the values of a string select component given a custom id
|
|
69
|
+
*
|
|
70
|
+
* @param {string} customId The custom id of the string select component
|
|
71
|
+
* @returns {string[]}
|
|
72
|
+
*/
|
|
73
|
+
getStringSelectValues(customId) {
|
|
74
|
+
return this.getField(customId, ComponentType.StringSelect).values;
|
|
75
|
+
}
|
|
57
76
|
}
|
|
58
77
|
|
|
59
78
|
exports.ModalSubmitFields = ModalSubmitFields;
|
|
@@ -9,16 +9,38 @@ const { InteractionResponses } = require('./interfaces/InteractionResponses.js')
|
|
|
9
9
|
const getMessage = lazy(() => require('./Message.js').Message);
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @typedef {Object}
|
|
13
|
-
* @property {string} value The value of the field
|
|
12
|
+
* @typedef {Object} BaseModalData
|
|
14
13
|
* @property {ComponentType} type The component type of the field
|
|
15
14
|
* @property {string} customId The custom id of the field
|
|
15
|
+
* @property {number} id The id of the field
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {BaseModalData} TextInputModalData
|
|
20
|
+
* @property {string} value The value of the field
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {BaseModalData} StringSelectModalData
|
|
25
|
+
* @property {string[]} values The values of the field
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {TextInputModalData | StringSelectModalData} ModalData
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {Object} LabelModalData
|
|
34
|
+
* @property {ModalData} component The component within the label
|
|
35
|
+
* @property {ComponentType} type The component type of the label
|
|
36
|
+
* @property {number} id The id of the label
|
|
16
37
|
*/
|
|
17
38
|
|
|
18
39
|
/**
|
|
19
40
|
* @typedef {Object} ActionRowModalData
|
|
20
|
-
* @property {
|
|
41
|
+
* @property {TextInputModalData[]} components The components of this action row
|
|
21
42
|
* @property {ComponentType} type The component type of the action row
|
|
43
|
+
* @property {number} id The id of the action row
|
|
22
44
|
*/
|
|
23
45
|
|
|
24
46
|
/**
|
|
@@ -51,7 +73,7 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|
|
51
73
|
/**
|
|
52
74
|
* The components within the modal
|
|
53
75
|
*
|
|
54
|
-
* @type {ActionRowModalData
|
|
76
|
+
* @type {Array<ActionRowModalData | LabelModalData>}
|
|
55
77
|
*/
|
|
56
78
|
this.components = data.data.components?.map(component => ModalSubmitInteraction.transformComponent(component));
|
|
57
79
|
|
|
@@ -96,18 +118,35 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|
|
96
118
|
*
|
|
97
119
|
* @param {*} rawComponent The data to transform
|
|
98
120
|
* @returns {ModalData[]}
|
|
121
|
+
* @private
|
|
99
122
|
*/
|
|
100
123
|
static transformComponent(rawComponent) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
124
|
+
if ('components' in rawComponent) {
|
|
125
|
+
return {
|
|
126
|
+
type: rawComponent.type,
|
|
127
|
+
id: rawComponent.id,
|
|
128
|
+
components: rawComponent.components.map(component => this.transformComponent(component)),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if ('component' in rawComponent) {
|
|
133
|
+
return {
|
|
134
|
+
type: rawComponent.type,
|
|
135
|
+
id: rawComponent.id,
|
|
136
|
+
component: this.transformComponent(rawComponent.component),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const data = {
|
|
141
|
+
type: rawComponent.type,
|
|
142
|
+
customId: rawComponent.custom_id,
|
|
143
|
+
id: rawComponent.id,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
if (rawComponent.value) data.value = rawComponent.value;
|
|
147
|
+
if (rawComponent.values) data.values = rawComponent.values;
|
|
148
|
+
|
|
149
|
+
return data;
|
|
111
150
|
}
|
|
112
151
|
|
|
113
152
|
/**
|
|
@@ -9,13 +9,6 @@ const { InteractionCallbackResponse } = require('../InteractionCallbackResponse.
|
|
|
9
9
|
const { InteractionCollector } = require('../InteractionCollector.js');
|
|
10
10
|
const { MessagePayload } = require('../MessagePayload.js');
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {Object} ModalComponentData
|
|
14
|
-
* @property {string} title The title of the modal
|
|
15
|
-
* @property {string} customId The custom id of the modal
|
|
16
|
-
* @property {ActionRow[]} components The components within this modal
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
12
|
/**
|
|
20
13
|
* Interface for classes that support shared interaction response types.
|
|
21
14
|
*
|
package/src/util/Components.js
CHANGED
|
@@ -15,6 +15,24 @@ const { ComponentType } = require('discord-api-types/v10');
|
|
|
15
15
|
* @property {ComponentData[]} components The components in this action row
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} ModalComponentData
|
|
20
|
+
* @property {string} title The title of the modal
|
|
21
|
+
* @property {string} customId The custom id of the modal
|
|
22
|
+
* @property {LabelData[]} components The components within this modal
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {StringSelectMenuComponentData|TextInputComponentData} ComponentInLabelData
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {BaseComponentData} LabelData
|
|
31
|
+
* @property {string} label The label to use
|
|
32
|
+
* @property {string} [description] The optional description for the label
|
|
33
|
+
* @property {ComponentInLabelData} component The component within the label
|
|
34
|
+
*/
|
|
35
|
+
|
|
18
36
|
/**
|
|
19
37
|
* @typedef {BaseComponentData} ButtonComponentData
|
|
20
38
|
* @property {ButtonStyle} style The style of the button
|
|
@@ -25,6 +43,17 @@ const { ComponentType } = require('discord-api-types/v10');
|
|
|
25
43
|
* @property {string} [url] The URL of the button
|
|
26
44
|
*/
|
|
27
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @typedef {BaseComponentData} StringSelectMenuComponentData
|
|
48
|
+
* @property {string} customId The custom id of the select menu
|
|
49
|
+
* @property {boolean} [disabled] Whether the select menu is disabled or not
|
|
50
|
+
* @property {number} [maxValues] The maximum amount of options that can be selected
|
|
51
|
+
* @property {number} [minValues] The minimum amount of options that can be selected
|
|
52
|
+
* @property {SelectMenuComponentOptionData[]} [options] The options in this select menu
|
|
53
|
+
* @property {string} [placeholder] The placeholder of the select menu
|
|
54
|
+
* @property {boolean} [required] Whether this component is required in modals
|
|
55
|
+
*/
|
|
56
|
+
|
|
28
57
|
/**
|
|
29
58
|
* @typedef {Object} SelectMenuComponentOptionData
|
|
30
59
|
* @property {string} label The label of the option
|
|
@@ -52,7 +81,6 @@ const { ComponentType } = require('discord-api-types/v10');
|
|
|
52
81
|
* @typedef {BaseComponentData} TextInputComponentData
|
|
53
82
|
* @property {string} customId The custom id of the text input
|
|
54
83
|
* @property {TextInputStyle} style The style of the text input
|
|
55
|
-
* @property {string} label The text that appears on top of the text input field
|
|
56
84
|
* @property {number} [minLength] The minimum number of characters that can be entered in the text input
|
|
57
85
|
* @property {number} [maxLength] The maximum number of characters that can be entered in the text input
|
|
58
86
|
* @property {boolean} [required] Whether or not the text input is required or not
|
|
@@ -186,6 +214,7 @@ const { ChannelSelectMenuComponent } = require('../structures/ChannelSelectMenuC
|
|
|
186
214
|
const { Component } = require('../structures/Component.js');
|
|
187
215
|
const { ContainerComponent } = require('../structures/ContainerComponent.js');
|
|
188
216
|
const { FileComponent } = require('../structures/FileComponent.js');
|
|
217
|
+
const { LabelComponent } = require('../structures/LabelComponent.js');
|
|
189
218
|
const { MediaGalleryComponent } = require('../structures/MediaGalleryComponent.js');
|
|
190
219
|
const { MentionableSelectMenuComponent } = require('../structures/MentionableSelectMenuComponent.js');
|
|
191
220
|
const { RoleSelectMenuComponent } = require('../structures/RoleSelectMenuComponent.js');
|
|
@@ -213,4 +242,5 @@ const ComponentTypeToClass = {
|
|
|
213
242
|
[ComponentType.Section]: SectionComponent,
|
|
214
243
|
[ComponentType.Separator]: SeparatorComponent,
|
|
215
244
|
[ComponentType.Thumbnail]: ThumbnailComponent,
|
|
245
|
+
[ComponentType.Label]: LabelComponent,
|
|
216
246
|
};
|
package/typings/index.d.mts
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
APIInteractionDataResolvedChannel,
|
|
51
51
|
APIInteractionDataResolvedGuildMember,
|
|
52
52
|
APIInteractionGuildMember,
|
|
53
|
+
APILabelComponent,
|
|
53
54
|
APIMediaGalleryComponent,
|
|
54
55
|
APIMediaGalleryItem,
|
|
55
56
|
APIMentionableSelectComponent,
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
APIMessageTopLevelComponent,
|
|
66
67
|
APIMessageUserSelectInteractionData,
|
|
67
68
|
APIModalComponent,
|
|
69
|
+
APIModalInteractionResponseCallbackComponent,
|
|
68
70
|
APIModalInteractionResponseCallbackData,
|
|
69
71
|
APIModalSubmitInteraction,
|
|
70
72
|
APIOverwrite,
|
|
@@ -248,6 +250,7 @@ export class Activity {
|
|
|
248
250
|
export type ActivityFlagsString = keyof typeof ActivityFlags;
|
|
249
251
|
|
|
250
252
|
export interface BaseComponentData {
|
|
253
|
+
id?: number;
|
|
251
254
|
type: ComponentType;
|
|
252
255
|
}
|
|
253
256
|
|
|
@@ -260,17 +263,22 @@ export type MessageActionRowComponentData =
|
|
|
260
263
|
| StringSelectMenuComponentData
|
|
261
264
|
| UserSelectMenuComponentData;
|
|
262
265
|
|
|
263
|
-
export type
|
|
266
|
+
export type ActionRowComponentData = MessageActionRowComponentData;
|
|
264
267
|
|
|
265
|
-
export type
|
|
266
|
-
|
|
267
|
-
export type ActionRowComponent = MessageActionRowComponent | ModalActionRowComponent;
|
|
268
|
+
export type ActionRowComponent = MessageActionRowComponent;
|
|
268
269
|
|
|
269
270
|
export interface ActionRowData<ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>>
|
|
270
271
|
extends BaseComponentData {
|
|
271
272
|
components: readonly ComponentType[];
|
|
272
273
|
}
|
|
273
274
|
|
|
275
|
+
export type ComponentInLabelData = StringSelectMenuComponentData | TextInputComponentData;
|
|
276
|
+
export interface LabelData extends BaseComponentData {
|
|
277
|
+
component: ComponentInLabelData;
|
|
278
|
+
description?: string;
|
|
279
|
+
label: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
274
282
|
export type MessageActionRowComponent =
|
|
275
283
|
| ButtonComponent
|
|
276
284
|
| ChannelSelectMenuComponent
|
|
@@ -278,12 +286,11 @@ export type MessageActionRowComponent =
|
|
|
278
286
|
| RoleSelectMenuComponent
|
|
279
287
|
| StringSelectMenuComponent
|
|
280
288
|
| UserSelectMenuComponent;
|
|
281
|
-
export type ModalActionRowComponent = TextInputComponent;
|
|
282
289
|
|
|
283
|
-
export class ActionRow<ComponentType extends MessageActionRowComponent
|
|
284
|
-
APIActionRowComponent<APIComponentInMessageActionRow
|
|
290
|
+
export class ActionRow<ComponentType extends MessageActionRowComponent> extends Component<
|
|
291
|
+
APIActionRowComponent<APIComponentInMessageActionRow>
|
|
285
292
|
> {
|
|
286
|
-
private constructor(data: APIActionRowComponent<APIComponentInMessageActionRow
|
|
293
|
+
private constructor(data: APIActionRowComponent<APIComponentInMessageActionRow>);
|
|
287
294
|
public readonly components: ComponentType[];
|
|
288
295
|
public toJSON(): APIActionRowComponent<ReturnType<ComponentType['toJSON']>>;
|
|
289
296
|
}
|
|
@@ -740,6 +747,12 @@ export class TextInputComponent extends Component<APITextInputComponent> {
|
|
|
740
747
|
public get value(): string;
|
|
741
748
|
}
|
|
742
749
|
|
|
750
|
+
export class LabelComponent extends Component<APILabelComponent> {
|
|
751
|
+
public component: StringSelectMenuComponent | TextInputComponent;
|
|
752
|
+
public get label(): string;
|
|
753
|
+
public get description(): string | null;
|
|
754
|
+
}
|
|
755
|
+
|
|
743
756
|
export class BaseSelectMenuComponent<Data extends APISelectMenuComponent> extends Component<Data> {
|
|
744
757
|
protected constructor(data: Data);
|
|
745
758
|
public get placeholder(): string | null;
|
|
@@ -2527,36 +2540,48 @@ export interface MessageReactionEventDetails {
|
|
|
2527
2540
|
}
|
|
2528
2541
|
|
|
2529
2542
|
export interface ModalComponentData {
|
|
2530
|
-
components: readonly
|
|
2531
|
-
| ActionRowData<ModalActionRowComponentData>
|
|
2532
|
-
| JSONEncodable<APIActionRowComponent<APIComponentInModalActionRow>>
|
|
2533
|
-
)[];
|
|
2543
|
+
components: readonly LabelData[];
|
|
2534
2544
|
customId: string;
|
|
2535
2545
|
title: string;
|
|
2536
2546
|
}
|
|
2537
2547
|
|
|
2538
|
-
export interface BaseModalData {
|
|
2548
|
+
export interface BaseModalData<Type extends ComponentType> {
|
|
2539
2549
|
customId: string;
|
|
2540
|
-
|
|
2550
|
+
id: number;
|
|
2551
|
+
type: Type;
|
|
2541
2552
|
}
|
|
2542
2553
|
|
|
2543
|
-
export interface TextInputModalData extends BaseModalData {
|
|
2544
|
-
type: ComponentType.TextInput;
|
|
2554
|
+
export interface TextInputModalData extends BaseModalData<ComponentType.TextInput> {
|
|
2545
2555
|
value: string;
|
|
2546
2556
|
}
|
|
2547
2557
|
|
|
2558
|
+
export interface StringSelectModalData extends BaseModalData<ComponentType.StringSelect> {
|
|
2559
|
+
values: readonly string[];
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
export type ModalData = StringSelectModalData | TextInputModalData;
|
|
2563
|
+
|
|
2564
|
+
export interface LabelModalData {
|
|
2565
|
+
component: readonly ModalData[];
|
|
2566
|
+
id: number;
|
|
2567
|
+
type: ComponentType.Label;
|
|
2568
|
+
}
|
|
2548
2569
|
export interface ActionRowModalData {
|
|
2549
2570
|
components: readonly TextInputModalData[];
|
|
2550
2571
|
type: ComponentType.ActionRow;
|
|
2551
2572
|
}
|
|
2552
2573
|
|
|
2553
2574
|
export class ModalSubmitFields {
|
|
2554
|
-
private constructor(components: readonly (
|
|
2555
|
-
public components: ActionRowModalData[];
|
|
2556
|
-
public fields: Collection<string, TextInputModalData>;
|
|
2557
|
-
public getField<Type extends ComponentType>(
|
|
2558
|
-
|
|
2575
|
+
private constructor(components: readonly (ActionRowModalData | LabelModalData)[]);
|
|
2576
|
+
public components: (ActionRowModalData | LabelModalData)[];
|
|
2577
|
+
public fields: Collection<string, StringSelectModalData | TextInputModalData>;
|
|
2578
|
+
public getField<Type extends ComponentType>(
|
|
2579
|
+
customId: string,
|
|
2580
|
+
type: Type,
|
|
2581
|
+
): { type: Type } & (StringSelectModalData | TextInputModalData);
|
|
2582
|
+
public getField(customId: string, type?: ComponentType): StringSelectModalData | TextInputModalData;
|
|
2559
2583
|
public getTextInputValue(customId: string): string;
|
|
2584
|
+
public getStringSelectValues(customId: string): readonly string[];
|
|
2560
2585
|
}
|
|
2561
2586
|
|
|
2562
2587
|
export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
|
|
@@ -2579,7 +2604,7 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|
|
2579
2604
|
private constructor(client: Client<true>, data: APIModalSubmitInteraction);
|
|
2580
2605
|
public type: InteractionType.ModalSubmit;
|
|
2581
2606
|
public readonly customId: string;
|
|
2582
|
-
public readonly components: ActionRowModalData[];
|
|
2607
|
+
public readonly components: (ActionRowModalData | LabelModalData)[];
|
|
2583
2608
|
public readonly fields: ModalSubmitFields;
|
|
2584
2609
|
public deferred: boolean;
|
|
2585
2610
|
public ephemeral: boolean | null;
|
|
@@ -3645,9 +3670,10 @@ export function verifyString(data: string, error?: typeof Error, errorMessage?:
|
|
|
3645
3670
|
|
|
3646
3671
|
export type ComponentData =
|
|
3647
3672
|
| ComponentInContainerData
|
|
3673
|
+
| ComponentInLabelData
|
|
3648
3674
|
| ContainerComponentData
|
|
3675
|
+
| LabelData
|
|
3649
3676
|
| MessageActionRowComponentData
|
|
3650
|
-
| ModalActionRowComponentData
|
|
3651
3677
|
| ThumbnailComponentData;
|
|
3652
3678
|
|
|
3653
3679
|
export interface SendSoundboardSoundOptions {
|
|
@@ -6669,6 +6695,7 @@ export interface BaseSelectMenuComponentData extends BaseComponentData {
|
|
|
6669
6695
|
|
|
6670
6696
|
export interface StringSelectMenuComponentData extends BaseSelectMenuComponentData {
|
|
6671
6697
|
options: readonly SelectMenuComponentOptionData[];
|
|
6698
|
+
required?: boolean;
|
|
6672
6699
|
type: ComponentType.StringSelect;
|
|
6673
6700
|
}
|
|
6674
6701
|
|
|
@@ -6718,7 +6745,6 @@ export interface SelectMenuComponentOptionData {
|
|
|
6718
6745
|
|
|
6719
6746
|
export interface TextInputComponentData extends BaseComponentData {
|
|
6720
6747
|
customId: string;
|
|
6721
|
-
label: string;
|
|
6722
6748
|
maxLength?: number;
|
|
6723
6749
|
minLength?: number;
|
|
6724
6750
|
placeholder?: string;
|
package/typings/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
APIInteractionDataResolvedChannel,
|
|
51
51
|
APIInteractionDataResolvedGuildMember,
|
|
52
52
|
APIInteractionGuildMember,
|
|
53
|
+
APILabelComponent,
|
|
53
54
|
APIMediaGalleryComponent,
|
|
54
55
|
APIMediaGalleryItem,
|
|
55
56
|
APIMentionableSelectComponent,
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
APIMessageTopLevelComponent,
|
|
66
67
|
APIMessageUserSelectInteractionData,
|
|
67
68
|
APIModalComponent,
|
|
69
|
+
APIModalInteractionResponseCallbackComponent,
|
|
68
70
|
APIModalInteractionResponseCallbackData,
|
|
69
71
|
APIModalSubmitInteraction,
|
|
70
72
|
APIOverwrite,
|
|
@@ -248,6 +250,7 @@ export class Activity {
|
|
|
248
250
|
export type ActivityFlagsString = keyof typeof ActivityFlags;
|
|
249
251
|
|
|
250
252
|
export interface BaseComponentData {
|
|
253
|
+
id?: number;
|
|
251
254
|
type: ComponentType;
|
|
252
255
|
}
|
|
253
256
|
|
|
@@ -260,17 +263,22 @@ export type MessageActionRowComponentData =
|
|
|
260
263
|
| StringSelectMenuComponentData
|
|
261
264
|
| UserSelectMenuComponentData;
|
|
262
265
|
|
|
263
|
-
export type
|
|
266
|
+
export type ActionRowComponentData = MessageActionRowComponentData;
|
|
264
267
|
|
|
265
|
-
export type
|
|
266
|
-
|
|
267
|
-
export type ActionRowComponent = MessageActionRowComponent | ModalActionRowComponent;
|
|
268
|
+
export type ActionRowComponent = MessageActionRowComponent;
|
|
268
269
|
|
|
269
270
|
export interface ActionRowData<ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>>
|
|
270
271
|
extends BaseComponentData {
|
|
271
272
|
components: readonly ComponentType[];
|
|
272
273
|
}
|
|
273
274
|
|
|
275
|
+
export type ComponentInLabelData = StringSelectMenuComponentData | TextInputComponentData;
|
|
276
|
+
export interface LabelData extends BaseComponentData {
|
|
277
|
+
component: ComponentInLabelData;
|
|
278
|
+
description?: string;
|
|
279
|
+
label: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
274
282
|
export type MessageActionRowComponent =
|
|
275
283
|
| ButtonComponent
|
|
276
284
|
| ChannelSelectMenuComponent
|
|
@@ -278,12 +286,11 @@ export type MessageActionRowComponent =
|
|
|
278
286
|
| RoleSelectMenuComponent
|
|
279
287
|
| StringSelectMenuComponent
|
|
280
288
|
| UserSelectMenuComponent;
|
|
281
|
-
export type ModalActionRowComponent = TextInputComponent;
|
|
282
289
|
|
|
283
|
-
export class ActionRow<ComponentType extends MessageActionRowComponent
|
|
284
|
-
APIActionRowComponent<APIComponentInMessageActionRow
|
|
290
|
+
export class ActionRow<ComponentType extends MessageActionRowComponent> extends Component<
|
|
291
|
+
APIActionRowComponent<APIComponentInMessageActionRow>
|
|
285
292
|
> {
|
|
286
|
-
private constructor(data: APIActionRowComponent<APIComponentInMessageActionRow
|
|
293
|
+
private constructor(data: APIActionRowComponent<APIComponentInMessageActionRow>);
|
|
287
294
|
public readonly components: ComponentType[];
|
|
288
295
|
public toJSON(): APIActionRowComponent<ReturnType<ComponentType['toJSON']>>;
|
|
289
296
|
}
|
|
@@ -740,6 +747,12 @@ export class TextInputComponent extends Component<APITextInputComponent> {
|
|
|
740
747
|
public get value(): string;
|
|
741
748
|
}
|
|
742
749
|
|
|
750
|
+
export class LabelComponent extends Component<APILabelComponent> {
|
|
751
|
+
public component: StringSelectMenuComponent | TextInputComponent;
|
|
752
|
+
public get label(): string;
|
|
753
|
+
public get description(): string | null;
|
|
754
|
+
}
|
|
755
|
+
|
|
743
756
|
export class BaseSelectMenuComponent<Data extends APISelectMenuComponent> extends Component<Data> {
|
|
744
757
|
protected constructor(data: Data);
|
|
745
758
|
public get placeholder(): string | null;
|
|
@@ -2527,36 +2540,48 @@ export interface MessageReactionEventDetails {
|
|
|
2527
2540
|
}
|
|
2528
2541
|
|
|
2529
2542
|
export interface ModalComponentData {
|
|
2530
|
-
components: readonly
|
|
2531
|
-
| ActionRowData<ModalActionRowComponentData>
|
|
2532
|
-
| JSONEncodable<APIActionRowComponent<APIComponentInModalActionRow>>
|
|
2533
|
-
)[];
|
|
2543
|
+
components: readonly LabelData[];
|
|
2534
2544
|
customId: string;
|
|
2535
2545
|
title: string;
|
|
2536
2546
|
}
|
|
2537
2547
|
|
|
2538
|
-
export interface BaseModalData {
|
|
2548
|
+
export interface BaseModalData<Type extends ComponentType> {
|
|
2539
2549
|
customId: string;
|
|
2540
|
-
|
|
2550
|
+
id: number;
|
|
2551
|
+
type: Type;
|
|
2541
2552
|
}
|
|
2542
2553
|
|
|
2543
|
-
export interface TextInputModalData extends BaseModalData {
|
|
2544
|
-
type: ComponentType.TextInput;
|
|
2554
|
+
export interface TextInputModalData extends BaseModalData<ComponentType.TextInput> {
|
|
2545
2555
|
value: string;
|
|
2546
2556
|
}
|
|
2547
2557
|
|
|
2558
|
+
export interface StringSelectModalData extends BaseModalData<ComponentType.StringSelect> {
|
|
2559
|
+
values: readonly string[];
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
export type ModalData = StringSelectModalData | TextInputModalData;
|
|
2563
|
+
|
|
2564
|
+
export interface LabelModalData {
|
|
2565
|
+
component: readonly ModalData[];
|
|
2566
|
+
id: number;
|
|
2567
|
+
type: ComponentType.Label;
|
|
2568
|
+
}
|
|
2548
2569
|
export interface ActionRowModalData {
|
|
2549
2570
|
components: readonly TextInputModalData[];
|
|
2550
2571
|
type: ComponentType.ActionRow;
|
|
2551
2572
|
}
|
|
2552
2573
|
|
|
2553
2574
|
export class ModalSubmitFields {
|
|
2554
|
-
private constructor(components: readonly (
|
|
2555
|
-
public components: ActionRowModalData[];
|
|
2556
|
-
public fields: Collection<string, TextInputModalData>;
|
|
2557
|
-
public getField<Type extends ComponentType>(
|
|
2558
|
-
|
|
2575
|
+
private constructor(components: readonly (ActionRowModalData | LabelModalData)[]);
|
|
2576
|
+
public components: (ActionRowModalData | LabelModalData)[];
|
|
2577
|
+
public fields: Collection<string, StringSelectModalData | TextInputModalData>;
|
|
2578
|
+
public getField<Type extends ComponentType>(
|
|
2579
|
+
customId: string,
|
|
2580
|
+
type: Type,
|
|
2581
|
+
): { type: Type } & (StringSelectModalData | TextInputModalData);
|
|
2582
|
+
public getField(customId: string, type?: ComponentType): StringSelectModalData | TextInputModalData;
|
|
2559
2583
|
public getTextInputValue(customId: string): string;
|
|
2584
|
+
public getStringSelectValues(customId: string): readonly string[];
|
|
2560
2585
|
}
|
|
2561
2586
|
|
|
2562
2587
|
export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
|
|
@@ -2579,7 +2604,7 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|
|
2579
2604
|
private constructor(client: Client<true>, data: APIModalSubmitInteraction);
|
|
2580
2605
|
public type: InteractionType.ModalSubmit;
|
|
2581
2606
|
public readonly customId: string;
|
|
2582
|
-
public readonly components: ActionRowModalData[];
|
|
2607
|
+
public readonly components: (ActionRowModalData | LabelModalData)[];
|
|
2583
2608
|
public readonly fields: ModalSubmitFields;
|
|
2584
2609
|
public deferred: boolean;
|
|
2585
2610
|
public ephemeral: boolean | null;
|
|
@@ -3645,9 +3670,10 @@ export function verifyString(data: string, error?: typeof Error, errorMessage?:
|
|
|
3645
3670
|
|
|
3646
3671
|
export type ComponentData =
|
|
3647
3672
|
| ComponentInContainerData
|
|
3673
|
+
| ComponentInLabelData
|
|
3648
3674
|
| ContainerComponentData
|
|
3675
|
+
| LabelData
|
|
3649
3676
|
| MessageActionRowComponentData
|
|
3650
|
-
| ModalActionRowComponentData
|
|
3651
3677
|
| ThumbnailComponentData;
|
|
3652
3678
|
|
|
3653
3679
|
export interface SendSoundboardSoundOptions {
|
|
@@ -6669,6 +6695,7 @@ export interface BaseSelectMenuComponentData extends BaseComponentData {
|
|
|
6669
6695
|
|
|
6670
6696
|
export interface StringSelectMenuComponentData extends BaseSelectMenuComponentData {
|
|
6671
6697
|
options: readonly SelectMenuComponentOptionData[];
|
|
6698
|
+
required?: boolean;
|
|
6672
6699
|
type: ComponentType.StringSelect;
|
|
6673
6700
|
}
|
|
6674
6701
|
|
|
@@ -6718,7 +6745,6 @@ export interface SelectMenuComponentOptionData {
|
|
|
6718
6745
|
|
|
6719
6746
|
export interface TextInputComponentData extends BaseComponentData {
|
|
6720
6747
|
customId: string;
|
|
6721
|
-
label: string;
|
|
6722
6748
|
maxLength?: number;
|
|
6723
6749
|
minLength?: number;
|
|
6724
6750
|
placeholder?: string;
|