@discordjs/builders 2.0.0-dev.1757030507-8ca279e0c → 2.0.0-dev.1757116903-f7c77a73d
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/dist/index.d.mts +436 -298
- package/dist/index.d.ts +436 -298
- package/dist/index.js +581 -464
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +533 -418
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_api_types_v10 from 'discord-api-types/v10';
|
|
2
|
-
import { APIButtonComponent, APIButtonComponentWithSKUId, APIMessageComponentEmoji, APIBaseComponent, ComponentType, APIButtonComponentWithCustomId, APIButtonComponentWithURL, Snowflake, APISelectMenuComponent,
|
|
2
|
+
import { APIButtonComponent, APIButtonComponentWithSKUId, APIMessageComponentEmoji, APIBaseComponent, ComponentType, APIButtonComponentWithCustomId, APIButtonComponentWithURL, Snowflake, APISelectMenuComponent, APISelectMenuOption, APIStringSelectComponent, APITextInputComponent, TextInputStyle, APILabelComponent, APIChannelSelectComponent, ChannelType, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIUserSelectComponent, APIFileComponent, APIMediaGalleryItem, APIMediaGalleryComponent, APITextDisplayComponent, APIThumbnailComponent, APISectionComponent, ButtonStyle, APISeparatorComponent, SeparatorSpacingSize, APIContainerComponent, APIActionRowComponent, APIComponentInMessageActionRow, APIComponentInContainer, APIModalComponent, APIMessageComponent, APISectionAccessoryComponent, APIComponentInActionRow, APIApplicationCommandIntegerOption, APIApplicationCommandChannelOption, APIApplicationCommandNumberOption, APIApplicationCommandStringOption, APIApplicationCommandOptionChoice, RESTPostAPIApplicationCommandsJSONBody, Locale, APIApplicationCommand, APIApplicationCommandBasicOption, APIApplicationCommandOption, ApplicationCommandOptionType, APIApplicationCommandSubcommandOption, APIApplicationCommandSubcommandGroupOption, InteractionContextType, ApplicationIntegrationType, Permissions, RESTPostAPIChatInputApplicationCommandsJSONBody, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody, APIModalInteractionResponseCallbackData, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbed, PollLayoutType, APIPollMedia, APIPartialEmoji, APIPollAnswer, RESTAPIPoll, APIAllowedMentions, AllowedMentionsTypes, MessageReferenceType, RESTAPIAttachment, RESTAPIMessageReference, RESTPostAPIChannelMessageJSONBody, APIMessageReference, APIMessageTopLevelComponent, APIAttachment, MessageFlags, APIPoll } from 'discord-api-types/v10';
|
|
3
3
|
import { JSONEncodable } from '@discordjs/util';
|
|
4
4
|
import * as ts_mixer_dist_types_types_js from 'ts-mixer/dist/types/types.js';
|
|
5
5
|
import * as zod from 'zod';
|
|
@@ -172,6 +172,22 @@ declare class PremiumButtonBuilder extends BaseButtonBuilder<APIButtonComponentW
|
|
|
172
172
|
setSKUId(skuId: Snowflake): this;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Normalizes data that is a rest parameter or an array into an array with a depth of 1.
|
|
177
|
+
*
|
|
178
|
+
* @typeParam ItemType - The data that must satisfy {@link RestOrArray}.
|
|
179
|
+
* @param arr - The (possibly variadic) data to normalize
|
|
180
|
+
*/
|
|
181
|
+
declare function normalizeArray<ItemType>(arr: RestOrArray<ItemType>): ItemType[];
|
|
182
|
+
/**
|
|
183
|
+
* Represents data that may be an array or came from a rest parameter.
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* This type is used throughout builders to ensure both an array and variadic arguments
|
|
187
|
+
* may be used. It is normalized with {@link normalizeArray}.
|
|
188
|
+
*/
|
|
189
|
+
type RestOrArray<Type> = Type[] | [Type[]];
|
|
190
|
+
|
|
175
191
|
/**
|
|
176
192
|
* The base select menu builder that contains common symbols for select menu builders.
|
|
177
193
|
*
|
|
@@ -219,359 +235,502 @@ declare abstract class BaseSelectMenuBuilder<Data extends APISelectMenuComponent
|
|
|
219
235
|
}
|
|
220
236
|
|
|
221
237
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* @typeParam ItemType - The data that must satisfy {@link RestOrArray}.
|
|
225
|
-
* @param arr - The (possibly variadic) data to normalize
|
|
226
|
-
*/
|
|
227
|
-
declare function normalizeArray<ItemType>(arr: RestOrArray<ItemType>): ItemType[];
|
|
228
|
-
/**
|
|
229
|
-
* Represents data that may be an array or came from a rest parameter.
|
|
230
|
-
*
|
|
231
|
-
* @remarks
|
|
232
|
-
* This type is used throughout builders to ensure both an array and variadic arguments
|
|
233
|
-
* may be used. It is normalized with {@link normalizeArray}.
|
|
234
|
-
*/
|
|
235
|
-
type RestOrArray<Type> = Type[] | [Type[]];
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* A builder that creates API-compatible JSON data for channel select menus.
|
|
238
|
+
* A builder that creates API-compatible JSON data for string select menu options.
|
|
239
239
|
*/
|
|
240
|
-
declare class
|
|
241
|
-
|
|
240
|
+
declare class StringSelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption> {
|
|
241
|
+
private readonly data;
|
|
242
242
|
/**
|
|
243
|
-
* Creates a new
|
|
243
|
+
* Creates a new string select menu option.
|
|
244
244
|
*
|
|
245
|
-
* @param data - The API data to create this
|
|
245
|
+
* @param data - The API data to create this string select menu option with
|
|
246
246
|
* @example
|
|
247
|
-
* Creating a select menu from an API data object:
|
|
247
|
+
* Creating a string select menu option from an API data object:
|
|
248
248
|
* ```ts
|
|
249
|
-
* const
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* max_values: 2,
|
|
249
|
+
* const selectMenuOption = new SelectMenuOptionBuilder({
|
|
250
|
+
* label: 'catchy label',
|
|
251
|
+
* value: '1',
|
|
253
252
|
* });
|
|
254
253
|
* ```
|
|
255
254
|
* @example
|
|
256
|
-
* Creating a select menu using setters and API data:
|
|
255
|
+
* Creating a string select menu option using setters and API data:
|
|
257
256
|
* ```ts
|
|
258
|
-
* const
|
|
259
|
-
*
|
|
257
|
+
* const selectMenuOption = new SelectMenuOptionBuilder({
|
|
258
|
+
* default: true,
|
|
259
|
+
* value: '1',
|
|
260
260
|
* })
|
|
261
|
-
* .
|
|
262
|
-
* .setMinValues(2);
|
|
261
|
+
* .setLabel('woah');
|
|
263
262
|
* ```
|
|
264
263
|
*/
|
|
265
|
-
constructor(data?: Partial<
|
|
264
|
+
constructor(data?: Partial<APISelectMenuOption>);
|
|
266
265
|
/**
|
|
267
|
-
*
|
|
266
|
+
* Sets the label for this option.
|
|
268
267
|
*
|
|
269
|
-
* @param
|
|
268
|
+
* @param label - The label to use
|
|
270
269
|
*/
|
|
271
|
-
|
|
270
|
+
setLabel(label: string): this;
|
|
272
271
|
/**
|
|
273
|
-
* Sets
|
|
272
|
+
* Sets the value for this option.
|
|
274
273
|
*
|
|
275
|
-
* @param
|
|
274
|
+
* @param value - The value to use
|
|
276
275
|
*/
|
|
277
|
-
|
|
276
|
+
setValue(value: string): this;
|
|
278
277
|
/**
|
|
279
|
-
*
|
|
278
|
+
* Sets the description for this option.
|
|
280
279
|
*
|
|
281
|
-
* @param
|
|
280
|
+
* @param description - The description to use
|
|
282
281
|
*/
|
|
283
|
-
|
|
282
|
+
setDescription(description: string): this;
|
|
284
283
|
/**
|
|
285
|
-
*
|
|
284
|
+
* Clears the description for this option.
|
|
285
|
+
*/
|
|
286
|
+
clearDescription(): this;
|
|
287
|
+
/**
|
|
288
|
+
* Sets whether this option is selected by default.
|
|
286
289
|
*
|
|
287
|
-
* @param
|
|
290
|
+
* @param isDefault - Whether this option is selected by default
|
|
288
291
|
*/
|
|
289
|
-
|
|
292
|
+
setDefault(isDefault?: boolean): this;
|
|
293
|
+
/**
|
|
294
|
+
* Sets the emoji to display for this option.
|
|
295
|
+
*
|
|
296
|
+
* @param emoji - The emoji to use
|
|
297
|
+
*/
|
|
298
|
+
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
299
|
+
/**
|
|
300
|
+
* Clears the emoji for this option.
|
|
301
|
+
*/
|
|
302
|
+
clearEmoji(): this;
|
|
290
303
|
/**
|
|
291
304
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
292
305
|
*/
|
|
293
|
-
toJSON(validationOverride?: boolean):
|
|
306
|
+
toJSON(validationOverride?: boolean): APISelectMenuOption;
|
|
294
307
|
}
|
|
295
308
|
|
|
309
|
+
interface StringSelectMenuData extends Partial<Omit<APIStringSelectComponent, 'options'>> {
|
|
310
|
+
options: StringSelectMenuOptionBuilder[];
|
|
311
|
+
required?: boolean;
|
|
312
|
+
}
|
|
296
313
|
/**
|
|
297
|
-
* A builder that creates API-compatible JSON data for
|
|
314
|
+
* A builder that creates API-compatible JSON data for string select menus.
|
|
298
315
|
*/
|
|
299
|
-
declare class
|
|
300
|
-
protected readonly data:
|
|
316
|
+
declare class StringSelectMenuBuilder extends BaseSelectMenuBuilder<APIStringSelectComponent> {
|
|
317
|
+
protected readonly data: StringSelectMenuData;
|
|
301
318
|
/**
|
|
302
|
-
*
|
|
319
|
+
* The options for this select menu.
|
|
320
|
+
*/
|
|
321
|
+
get options(): readonly StringSelectMenuOptionBuilder[];
|
|
322
|
+
/**
|
|
323
|
+
* Creates a new string select menu.
|
|
303
324
|
*
|
|
304
|
-
* @param data - The API data to create this
|
|
325
|
+
* @param data - The API data to create this string select menu with
|
|
305
326
|
* @example
|
|
306
327
|
* Creating a select menu from an API data object:
|
|
307
328
|
* ```ts
|
|
308
|
-
* const selectMenu = new
|
|
329
|
+
* const selectMenu = new StringSelectMenuBuilder({
|
|
309
330
|
* custom_id: 'a cool select menu',
|
|
310
331
|
* placeholder: 'select an option',
|
|
311
332
|
* max_values: 2,
|
|
333
|
+
* options: [
|
|
334
|
+
* { label: 'option 1', value: '1' },
|
|
335
|
+
* { label: 'option 2', value: '2' },
|
|
336
|
+
* { label: 'option 3', value: '3' },
|
|
337
|
+
* ],
|
|
312
338
|
* });
|
|
313
339
|
* ```
|
|
314
340
|
* @example
|
|
315
341
|
* Creating a select menu using setters and API data:
|
|
316
342
|
* ```ts
|
|
317
|
-
* const selectMenu = new
|
|
343
|
+
* const selectMenu = new StringSelectMenuBuilder({
|
|
318
344
|
* custom_id: 'a cool select menu',
|
|
319
345
|
* })
|
|
320
|
-
* .setMinValues(1)
|
|
346
|
+
* .setMinValues(1)
|
|
347
|
+
* .addOptions({
|
|
348
|
+
* label: 'Catchy',
|
|
349
|
+
* value: 'catch',
|
|
350
|
+
* });
|
|
321
351
|
* ```
|
|
322
352
|
*/
|
|
323
|
-
constructor(data?: Partial<
|
|
353
|
+
constructor(data?: Partial<APIStringSelectComponent>);
|
|
324
354
|
/**
|
|
325
|
-
* Adds
|
|
355
|
+
* Adds options to this select menu.
|
|
326
356
|
*
|
|
327
|
-
* @param
|
|
357
|
+
* @param options - The options to add
|
|
328
358
|
*/
|
|
329
|
-
|
|
359
|
+
addOptions(...options: RestOrArray<APISelectMenuOption | StringSelectMenuOptionBuilder | ((builder: StringSelectMenuOptionBuilder) => StringSelectMenuOptionBuilder)>): this;
|
|
330
360
|
/**
|
|
331
|
-
*
|
|
361
|
+
* Sets the options for this select menu.
|
|
332
362
|
*
|
|
333
|
-
* @param
|
|
363
|
+
* @param options - The options to set
|
|
334
364
|
*/
|
|
335
|
-
|
|
365
|
+
setOptions(...options: RestOrArray<APISelectMenuOption | StringSelectMenuOptionBuilder | ((builder: StringSelectMenuOptionBuilder) => StringSelectMenuOptionBuilder)>): this;
|
|
336
366
|
/**
|
|
337
|
-
*
|
|
367
|
+
* Removes, replaces, or inserts options for this select menu.
|
|
338
368
|
*
|
|
339
|
-
* @
|
|
369
|
+
* @remarks
|
|
370
|
+
* This method behaves similarly
|
|
371
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice()}.
|
|
372
|
+
* It's useful for modifying and adjusting the order of existing options.
|
|
373
|
+
* @example
|
|
374
|
+
* Remove the first option:
|
|
375
|
+
* ```ts
|
|
376
|
+
* selectMenu.spliceOptions(0, 1);
|
|
377
|
+
* ```
|
|
378
|
+
* @example
|
|
379
|
+
* Remove the first n option:
|
|
380
|
+
* ```ts
|
|
381
|
+
* const n = 4;
|
|
382
|
+
* selectMenu.spliceOptions(0, n);
|
|
383
|
+
* ```
|
|
384
|
+
* @example
|
|
385
|
+
* Remove the last option:
|
|
386
|
+
* ```ts
|
|
387
|
+
* selectMenu.spliceOptions(-1, 1);
|
|
388
|
+
* ```
|
|
389
|
+
* @param index - The index to start at
|
|
390
|
+
* @param deleteCount - The number of options to remove
|
|
391
|
+
* @param options - The replacing option objects or builders
|
|
340
392
|
*/
|
|
341
|
-
|
|
393
|
+
spliceOptions(index: number, deleteCount: number, ...options: (APISelectMenuOption | StringSelectMenuOptionBuilder | ((builder: StringSelectMenuOptionBuilder) => StringSelectMenuOptionBuilder))[]): this;
|
|
342
394
|
/**
|
|
343
|
-
* Sets
|
|
395
|
+
* Sets whether this string select menu is required.
|
|
344
396
|
*
|
|
345
|
-
* @
|
|
397
|
+
* @remarks Only for use in modals.
|
|
398
|
+
* @param required - Whether this string select menu is required
|
|
346
399
|
*/
|
|
347
|
-
|
|
400
|
+
setRequired(required?: boolean): this;
|
|
348
401
|
/**
|
|
349
402
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
350
403
|
*/
|
|
351
|
-
toJSON(validationOverride?: boolean):
|
|
404
|
+
toJSON(validationOverride?: boolean): APIStringSelectComponent;
|
|
352
405
|
}
|
|
353
406
|
|
|
354
407
|
/**
|
|
355
|
-
* A builder that creates API-compatible JSON data for
|
|
408
|
+
* A builder that creates API-compatible JSON data for text inputs.
|
|
356
409
|
*/
|
|
357
|
-
declare class
|
|
358
|
-
protected readonly data: Partial<APIRoleSelectComponent>;
|
|
410
|
+
declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> {
|
|
359
411
|
/**
|
|
360
|
-
*
|
|
412
|
+
* @internal
|
|
413
|
+
*/
|
|
414
|
+
protected readonly data: Partial<APITextInputComponent>;
|
|
415
|
+
/**
|
|
416
|
+
* Creates a new text input.
|
|
361
417
|
*
|
|
362
|
-
* @param data - The API data to create this
|
|
418
|
+
* @param data - The API data to create this text input with
|
|
363
419
|
* @example
|
|
364
|
-
* Creating a
|
|
420
|
+
* Creating a text input from an API data object:
|
|
365
421
|
* ```ts
|
|
366
|
-
* const
|
|
367
|
-
* custom_id: 'a cool
|
|
368
|
-
* placeholder: '
|
|
369
|
-
*
|
|
422
|
+
* const textInput = new TextInputBuilder({
|
|
423
|
+
* custom_id: 'a cool text input',
|
|
424
|
+
* placeholder: 'Type something',
|
|
425
|
+
* style: TextInputStyle.Short,
|
|
370
426
|
* });
|
|
371
427
|
* ```
|
|
372
428
|
* @example
|
|
373
|
-
* Creating a
|
|
429
|
+
* Creating a text input using setters and API data:
|
|
374
430
|
* ```ts
|
|
375
|
-
* const
|
|
376
|
-
*
|
|
431
|
+
* const textInput = new TextInputBuilder({
|
|
432
|
+
* placeholder: 'Type something else',
|
|
377
433
|
* })
|
|
378
|
-
* .
|
|
434
|
+
* .setCustomId('woah')
|
|
435
|
+
* .setStyle(TextInputStyle.Paragraph);
|
|
379
436
|
* ```
|
|
380
437
|
*/
|
|
381
|
-
constructor(data?: Partial<
|
|
438
|
+
constructor(data?: Partial<APITextInputComponent>);
|
|
382
439
|
/**
|
|
383
|
-
*
|
|
440
|
+
* Sets the custom id for this text input.
|
|
384
441
|
*
|
|
385
|
-
* @param
|
|
442
|
+
* @param customId - The custom id to use
|
|
386
443
|
*/
|
|
387
|
-
|
|
444
|
+
setCustomId(customId: string): this;
|
|
388
445
|
/**
|
|
389
|
-
* Sets
|
|
446
|
+
* Sets the style for this text input.
|
|
390
447
|
*
|
|
391
|
-
* @param
|
|
448
|
+
* @param style - The style to use
|
|
392
449
|
*/
|
|
393
|
-
|
|
450
|
+
setStyle(style: TextInputStyle): this;
|
|
451
|
+
/**
|
|
452
|
+
* Sets the minimum length of text for this text input.
|
|
453
|
+
*
|
|
454
|
+
* @param minLength - The minimum length of text for this text input
|
|
455
|
+
*/
|
|
456
|
+
setMinLength(minLength: number): this;
|
|
457
|
+
/**
|
|
458
|
+
* Clears the minimum length of text for this text input.
|
|
459
|
+
*/
|
|
460
|
+
clearMinLength(): this;
|
|
461
|
+
/**
|
|
462
|
+
* Sets the maximum length of text for this text input.
|
|
463
|
+
*
|
|
464
|
+
* @param maxLength - The maximum length of text for this text input
|
|
465
|
+
*/
|
|
466
|
+
setMaxLength(maxLength: number): this;
|
|
467
|
+
/**
|
|
468
|
+
* Clears the maximum length of text for this text input.
|
|
469
|
+
*/
|
|
470
|
+
clearMaxLength(): this;
|
|
471
|
+
/**
|
|
472
|
+
* Sets the placeholder for this text input.
|
|
473
|
+
*
|
|
474
|
+
* @param placeholder - The placeholder to use
|
|
475
|
+
*/
|
|
476
|
+
setPlaceholder(placeholder: string): this;
|
|
477
|
+
/**
|
|
478
|
+
* Clears the placeholder for this text input.
|
|
479
|
+
*/
|
|
480
|
+
clearPlaceholder(): this;
|
|
481
|
+
/**
|
|
482
|
+
* Sets the value for this text input.
|
|
483
|
+
*
|
|
484
|
+
* @param value - The value to use
|
|
485
|
+
*/
|
|
486
|
+
setValue(value: string): this;
|
|
487
|
+
/**
|
|
488
|
+
* Clears the value for this text input.
|
|
489
|
+
*/
|
|
490
|
+
clearValue(): this;
|
|
491
|
+
/**
|
|
492
|
+
* Sets whether this text input is required.
|
|
493
|
+
*
|
|
494
|
+
* @param required - Whether this text input is required
|
|
495
|
+
*/
|
|
496
|
+
setRequired(required?: boolean): this;
|
|
394
497
|
/**
|
|
395
498
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
396
499
|
*/
|
|
397
|
-
toJSON(validationOverride?: boolean):
|
|
500
|
+
toJSON(validationOverride?: boolean): APITextInputComponent;
|
|
398
501
|
}
|
|
399
502
|
|
|
503
|
+
interface LabelBuilderData extends Partial<Omit<APILabelComponent, 'component'>> {
|
|
504
|
+
component?: StringSelectMenuBuilder | TextInputBuilder;
|
|
505
|
+
}
|
|
400
506
|
/**
|
|
401
|
-
* A builder that creates API-compatible JSON data for
|
|
507
|
+
* A builder that creates API-compatible JSON data for labels.
|
|
402
508
|
*/
|
|
403
|
-
declare class
|
|
404
|
-
private readonly data;
|
|
509
|
+
declare class LabelBuilder extends ComponentBuilder<APILabelComponent> {
|
|
405
510
|
/**
|
|
406
|
-
*
|
|
511
|
+
* @internal
|
|
512
|
+
*/
|
|
513
|
+
protected readonly data: LabelBuilderData;
|
|
514
|
+
/**
|
|
515
|
+
* Creates a new label.
|
|
407
516
|
*
|
|
408
|
-
* @param data - The API data to create this
|
|
517
|
+
* @param data - The API data to create this label with
|
|
409
518
|
* @example
|
|
410
|
-
* Creating a
|
|
519
|
+
* Creating a label from an API data object:
|
|
411
520
|
* ```ts
|
|
412
|
-
* const
|
|
413
|
-
* label:
|
|
414
|
-
*
|
|
521
|
+
* const label = new LabelBuilder({
|
|
522
|
+
* label: "label",
|
|
523
|
+
* component,
|
|
415
524
|
* });
|
|
416
525
|
* ```
|
|
417
526
|
* @example
|
|
418
|
-
* Creating a
|
|
527
|
+
* Creating a label using setters and API data:
|
|
419
528
|
* ```ts
|
|
420
|
-
* const
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
* })
|
|
424
|
-
* .setLabel('woah');
|
|
529
|
+
* const label = new LabelBuilder({
|
|
530
|
+
* label: 'label',
|
|
531
|
+
* component,
|
|
532
|
+
* }).setContent('new text');
|
|
425
533
|
* ```
|
|
426
534
|
*/
|
|
427
|
-
constructor(data?: Partial<
|
|
535
|
+
constructor(data?: Partial<APILabelComponent>);
|
|
428
536
|
/**
|
|
429
|
-
* Sets the label for this
|
|
537
|
+
* Sets the label for this label.
|
|
430
538
|
*
|
|
431
539
|
* @param label - The label to use
|
|
432
540
|
*/
|
|
433
541
|
setLabel(label: string): this;
|
|
434
542
|
/**
|
|
435
|
-
* Sets the
|
|
543
|
+
* Sets the description for this label.
|
|
436
544
|
*
|
|
437
|
-
* @param
|
|
545
|
+
* @param description - The description to use
|
|
438
546
|
*/
|
|
439
|
-
|
|
547
|
+
setDescription(description: string): this;
|
|
440
548
|
/**
|
|
441
|
-
*
|
|
549
|
+
* Clears the description for this label.
|
|
550
|
+
*/
|
|
551
|
+
clearDescription(): this;
|
|
552
|
+
/**
|
|
553
|
+
* Sets a string select menu component to this label.
|
|
442
554
|
*
|
|
443
|
-
* @param
|
|
555
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
556
|
+
*/
|
|
557
|
+
setStringSelectMenuComponent(input: APIStringSelectComponent | StringSelectMenuBuilder | ((builder: StringSelectMenuBuilder) => StringSelectMenuBuilder)): this;
|
|
558
|
+
/**
|
|
559
|
+
* Sets a text input component to this label.
|
|
560
|
+
*
|
|
561
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
562
|
+
*/
|
|
563
|
+
setTextInputComponent(input: APITextInputComponent | TextInputBuilder | ((builder: TextInputBuilder) => TextInputBuilder)): this;
|
|
564
|
+
/**
|
|
565
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
566
|
+
*/
|
|
567
|
+
toJSON(validationOverride?: boolean): APILabelComponent;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
declare const labelPredicate: z.ZodObject<{
|
|
571
|
+
type: z.ZodLiteral<ComponentType.Label>;
|
|
572
|
+
label: z.ZodString;
|
|
573
|
+
description: z.ZodOptional<z.ZodString>;
|
|
574
|
+
component: z.ZodUnion<readonly [z.ZodObject<{
|
|
575
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
576
|
+
min_values: z.ZodOptional<z.ZodNumber>;
|
|
577
|
+
max_values: z.ZodOptional<z.ZodNumber>;
|
|
578
|
+
custom_id: z.ZodString;
|
|
579
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
580
|
+
type: z.ZodLiteral<ComponentType.StringSelect>;
|
|
581
|
+
options: z.ZodArray<z.ZodObject<{
|
|
582
|
+
label: z.ZodString;
|
|
583
|
+
value: z.ZodString;
|
|
584
|
+
description: z.ZodOptional<z.ZodString>;
|
|
585
|
+
emoji: z.ZodOptional<z.ZodObject<{
|
|
586
|
+
id: z.ZodOptional<z.ZodString>;
|
|
587
|
+
name: z.ZodOptional<z.ZodString>;
|
|
588
|
+
animated: z.ZodOptional<z.ZodBoolean>;
|
|
589
|
+
}, z.core.$strict>>;
|
|
590
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
591
|
+
}, z.core.$strip>>;
|
|
592
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
593
|
+
type: z.ZodLiteral<ComponentType.TextInput>;
|
|
594
|
+
custom_id: z.ZodString;
|
|
595
|
+
style: z.ZodEnum<typeof discord_api_types_v10.TextInputStyle>;
|
|
596
|
+
min_length: z.ZodOptional<z.ZodNumber>;
|
|
597
|
+
max_length: z.ZodOptional<z.ZodNumber>;
|
|
598
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
599
|
+
value: z.ZodOptional<z.ZodString>;
|
|
600
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
601
|
+
}, z.core.$strip>]>;
|
|
602
|
+
}, z.core.$strip>;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* A builder that creates API-compatible JSON data for channel select menus.
|
|
606
|
+
*/
|
|
607
|
+
declare class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder<APIChannelSelectComponent> {
|
|
608
|
+
protected readonly data: Partial<APIChannelSelectComponent>;
|
|
609
|
+
/**
|
|
610
|
+
* Creates a new channel select menu.
|
|
611
|
+
*
|
|
612
|
+
* @param data - The API data to create this channel select menu with
|
|
613
|
+
* @example
|
|
614
|
+
* Creating a select menu from an API data object:
|
|
615
|
+
* ```ts
|
|
616
|
+
* const selectMenu = new ChannelSelectMenuBuilder({
|
|
617
|
+
* custom_id: 'a cool select menu',
|
|
618
|
+
* placeholder: 'select an option',
|
|
619
|
+
* max_values: 2,
|
|
620
|
+
* });
|
|
621
|
+
* ```
|
|
622
|
+
* @example
|
|
623
|
+
* Creating a select menu using setters and API data:
|
|
624
|
+
* ```ts
|
|
625
|
+
* const selectMenu = new ChannelSelectMenuBuilder({
|
|
626
|
+
* custom_id: 'a cool select menu',
|
|
627
|
+
* })
|
|
628
|
+
* .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
|
629
|
+
* .setMinValues(2);
|
|
630
|
+
* ```
|
|
444
631
|
*/
|
|
445
|
-
|
|
632
|
+
constructor(data?: Partial<APIChannelSelectComponent>);
|
|
446
633
|
/**
|
|
447
|
-
*
|
|
634
|
+
* Adds channel types to this select menu.
|
|
635
|
+
*
|
|
636
|
+
* @param types - The channel types to use
|
|
448
637
|
*/
|
|
449
|
-
|
|
638
|
+
addChannelTypes(...types: RestOrArray<ChannelType>): this;
|
|
450
639
|
/**
|
|
451
|
-
* Sets
|
|
640
|
+
* Sets channel types for this select menu.
|
|
452
641
|
*
|
|
453
|
-
* @param
|
|
642
|
+
* @param types - The channel types to use
|
|
454
643
|
*/
|
|
455
|
-
|
|
644
|
+
setChannelTypes(...types: RestOrArray<ChannelType>): this;
|
|
456
645
|
/**
|
|
457
|
-
*
|
|
646
|
+
* Adds default channels to this auto populated select menu.
|
|
458
647
|
*
|
|
459
|
-
* @param
|
|
648
|
+
* @param channels - The channels to add
|
|
460
649
|
*/
|
|
461
|
-
|
|
650
|
+
addDefaultChannels(...channels: RestOrArray<Snowflake>): this;
|
|
462
651
|
/**
|
|
463
|
-
*
|
|
652
|
+
* Sets default channels for this auto populated select menu.
|
|
653
|
+
*
|
|
654
|
+
* @param channels - The channels to set
|
|
464
655
|
*/
|
|
465
|
-
|
|
656
|
+
setDefaultChannels(...channels: RestOrArray<Snowflake>): this;
|
|
466
657
|
/**
|
|
467
658
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
468
659
|
*/
|
|
469
|
-
toJSON(validationOverride?: boolean):
|
|
660
|
+
toJSON(validationOverride?: boolean): APIChannelSelectComponent;
|
|
470
661
|
}
|
|
471
662
|
|
|
472
|
-
interface StringSelectMenuData extends Partial<Omit<APIStringSelectComponent, 'options'>> {
|
|
473
|
-
options: StringSelectMenuOptionBuilder[];
|
|
474
|
-
}
|
|
475
663
|
/**
|
|
476
|
-
* A builder that creates API-compatible JSON data for
|
|
664
|
+
* A builder that creates API-compatible JSON data for mentionable select menus.
|
|
477
665
|
*/
|
|
478
|
-
declare class
|
|
479
|
-
protected readonly data:
|
|
480
|
-
/**
|
|
481
|
-
* The options for this select menu.
|
|
482
|
-
*/
|
|
483
|
-
get options(): readonly StringSelectMenuOptionBuilder[];
|
|
666
|
+
declare class MentionableSelectMenuBuilder extends BaseSelectMenuBuilder<APIMentionableSelectComponent> {
|
|
667
|
+
protected readonly data: Partial<APIMentionableSelectComponent>;
|
|
484
668
|
/**
|
|
485
|
-
* Creates a new
|
|
669
|
+
* Creates a new mentionable select menu.
|
|
486
670
|
*
|
|
487
|
-
* @param data - The API data to create this
|
|
671
|
+
* @param data - The API data to create this mentionable select menu with
|
|
488
672
|
* @example
|
|
489
673
|
* Creating a select menu from an API data object:
|
|
490
674
|
* ```ts
|
|
491
|
-
* const selectMenu = new
|
|
675
|
+
* const selectMenu = new MentionableSelectMenuBuilder({
|
|
492
676
|
* custom_id: 'a cool select menu',
|
|
493
677
|
* placeholder: 'select an option',
|
|
494
678
|
* max_values: 2,
|
|
495
|
-
* options: [
|
|
496
|
-
* { label: 'option 1', value: '1' },
|
|
497
|
-
* { label: 'option 2', value: '2' },
|
|
498
|
-
* { label: 'option 3', value: '3' },
|
|
499
|
-
* ],
|
|
500
679
|
* });
|
|
501
680
|
* ```
|
|
502
681
|
* @example
|
|
503
682
|
* Creating a select menu using setters and API data:
|
|
504
683
|
* ```ts
|
|
505
|
-
* const selectMenu = new
|
|
684
|
+
* const selectMenu = new MentionableSelectMenuBuilder({
|
|
506
685
|
* custom_id: 'a cool select menu',
|
|
507
686
|
* })
|
|
508
|
-
* .setMinValues(1)
|
|
509
|
-
* .addOptions({
|
|
510
|
-
* label: 'Catchy',
|
|
511
|
-
* value: 'catch',
|
|
512
|
-
* });
|
|
687
|
+
* .setMinValues(1);
|
|
513
688
|
* ```
|
|
514
689
|
*/
|
|
515
|
-
constructor(data?: Partial<
|
|
690
|
+
constructor(data?: Partial<APIMentionableSelectComponent>);
|
|
516
691
|
/**
|
|
517
|
-
* Adds
|
|
692
|
+
* Adds default roles to this auto populated select menu.
|
|
518
693
|
*
|
|
519
|
-
* @param
|
|
694
|
+
* @param roles - The roles to add
|
|
520
695
|
*/
|
|
521
|
-
|
|
696
|
+
addDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
522
697
|
/**
|
|
523
|
-
*
|
|
698
|
+
* Adds default users to this auto populated select menu.
|
|
524
699
|
*
|
|
525
|
-
* @param
|
|
700
|
+
* @param users - The users to add
|
|
526
701
|
*/
|
|
527
|
-
|
|
702
|
+
addDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
528
703
|
/**
|
|
529
|
-
*
|
|
704
|
+
* Adds default values to this auto populated select menu.
|
|
530
705
|
*
|
|
531
|
-
* @
|
|
532
|
-
* This method behaves similarly
|
|
533
|
-
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice()}.
|
|
534
|
-
* It's useful for modifying and adjusting the order of existing options.
|
|
535
|
-
* @example
|
|
536
|
-
* Remove the first option:
|
|
537
|
-
* ```ts
|
|
538
|
-
* selectMenu.spliceOptions(0, 1);
|
|
539
|
-
* ```
|
|
540
|
-
* @example
|
|
541
|
-
* Remove the first n option:
|
|
542
|
-
* ```ts
|
|
543
|
-
* const n = 4;
|
|
544
|
-
* selectMenu.spliceOptions(0, n);
|
|
545
|
-
* ```
|
|
546
|
-
* @example
|
|
547
|
-
* Remove the last option:
|
|
548
|
-
* ```ts
|
|
549
|
-
* selectMenu.spliceOptions(-1, 1);
|
|
550
|
-
* ```
|
|
551
|
-
* @param index - The index to start at
|
|
552
|
-
* @param deleteCount - The number of options to remove
|
|
553
|
-
* @param options - The replacing option objects or builders
|
|
706
|
+
* @param values - The values to add
|
|
554
707
|
*/
|
|
555
|
-
|
|
708
|
+
addDefaultValues(...values: RestOrArray<APISelectMenuDefaultValue<SelectMenuDefaultValueType.Role> | APISelectMenuDefaultValue<SelectMenuDefaultValueType.User>>): this;
|
|
709
|
+
/**
|
|
710
|
+
* Sets default values for this auto populated select menu.
|
|
711
|
+
*
|
|
712
|
+
* @param values - The values to set
|
|
713
|
+
*/
|
|
714
|
+
setDefaultValues(...values: RestOrArray<APISelectMenuDefaultValue<SelectMenuDefaultValueType.Role> | APISelectMenuDefaultValue<SelectMenuDefaultValueType.User>>): this;
|
|
556
715
|
/**
|
|
557
716
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
558
717
|
*/
|
|
559
|
-
toJSON(validationOverride?: boolean):
|
|
718
|
+
toJSON(validationOverride?: boolean): APIMentionableSelectComponent;
|
|
560
719
|
}
|
|
561
720
|
|
|
562
721
|
/**
|
|
563
|
-
* A builder that creates API-compatible JSON data for
|
|
722
|
+
* A builder that creates API-compatible JSON data for role select menus.
|
|
564
723
|
*/
|
|
565
|
-
declare class
|
|
566
|
-
protected readonly data: Partial<
|
|
724
|
+
declare class RoleSelectMenuBuilder extends BaseSelectMenuBuilder<APIRoleSelectComponent> {
|
|
725
|
+
protected readonly data: Partial<APIRoleSelectComponent>;
|
|
567
726
|
/**
|
|
568
|
-
* Creates a new
|
|
727
|
+
* Creates a new role select menu.
|
|
569
728
|
*
|
|
570
|
-
* @param data - The API data to create this
|
|
729
|
+
* @param data - The API data to create this role select menu with
|
|
571
730
|
* @example
|
|
572
731
|
* Creating a select menu from an API data object:
|
|
573
732
|
* ```ts
|
|
574
|
-
* const selectMenu = new
|
|
733
|
+
* const selectMenu = new RoleSelectMenuBuilder({
|
|
575
734
|
* custom_id: 'a cool select menu',
|
|
576
735
|
* placeholder: 'select an option',
|
|
577
736
|
* max_values: 2,
|
|
@@ -580,137 +739,80 @@ declare class UserSelectMenuBuilder extends BaseSelectMenuBuilder<APIUserSelectC
|
|
|
580
739
|
* @example
|
|
581
740
|
* Creating a select menu using setters and API data:
|
|
582
741
|
* ```ts
|
|
583
|
-
* const selectMenu = new
|
|
742
|
+
* const selectMenu = new RoleSelectMenuBuilder({
|
|
584
743
|
* custom_id: 'a cool select menu',
|
|
585
744
|
* })
|
|
586
745
|
* .setMinValues(1);
|
|
587
746
|
* ```
|
|
588
747
|
*/
|
|
589
|
-
constructor(data?: Partial<
|
|
748
|
+
constructor(data?: Partial<APIRoleSelectComponent>);
|
|
590
749
|
/**
|
|
591
|
-
* Adds default
|
|
750
|
+
* Adds default roles to this auto populated select menu.
|
|
592
751
|
*
|
|
593
|
-
* @param
|
|
752
|
+
* @param roles - The roles to add
|
|
594
753
|
*/
|
|
595
|
-
|
|
754
|
+
addDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
596
755
|
/**
|
|
597
|
-
* Sets default
|
|
756
|
+
* Sets default roles for this auto populated select menu.
|
|
598
757
|
*
|
|
599
|
-
* @param
|
|
758
|
+
* @param roles - The roles to set
|
|
600
759
|
*/
|
|
601
|
-
|
|
760
|
+
setDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
602
761
|
/**
|
|
603
762
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
604
763
|
*/
|
|
605
|
-
toJSON(validationOverride?: boolean):
|
|
764
|
+
toJSON(validationOverride?: boolean): APIRoleSelectComponent;
|
|
606
765
|
}
|
|
607
766
|
|
|
608
767
|
/**
|
|
609
|
-
* A builder that creates API-compatible JSON data for
|
|
768
|
+
* A builder that creates API-compatible JSON data for user select menus.
|
|
610
769
|
*/
|
|
611
|
-
declare class
|
|
612
|
-
|
|
613
|
-
* @internal
|
|
614
|
-
*/
|
|
615
|
-
protected readonly data: Partial<APITextInputComponent>;
|
|
770
|
+
declare class UserSelectMenuBuilder extends BaseSelectMenuBuilder<APIUserSelectComponent> {
|
|
771
|
+
protected readonly data: Partial<APIUserSelectComponent>;
|
|
616
772
|
/**
|
|
617
|
-
* Creates a new
|
|
773
|
+
* Creates a new user select menu.
|
|
618
774
|
*
|
|
619
|
-
* @param data - The API data to create this
|
|
775
|
+
* @param data - The API data to create this user select menu with
|
|
620
776
|
* @example
|
|
621
|
-
* Creating a
|
|
777
|
+
* Creating a select menu from an API data object:
|
|
622
778
|
* ```ts
|
|
623
|
-
* const
|
|
624
|
-
* custom_id: 'a cool
|
|
625
|
-
*
|
|
626
|
-
*
|
|
779
|
+
* const selectMenu = new UserSelectMenuBuilder({
|
|
780
|
+
* custom_id: 'a cool select menu',
|
|
781
|
+
* placeholder: 'select an option',
|
|
782
|
+
* max_values: 2,
|
|
627
783
|
* });
|
|
628
784
|
* ```
|
|
629
785
|
* @example
|
|
630
|
-
* Creating a
|
|
786
|
+
* Creating a select menu using setters and API data:
|
|
631
787
|
* ```ts
|
|
632
|
-
* const
|
|
633
|
-
*
|
|
788
|
+
* const selectMenu = new UserSelectMenuBuilder({
|
|
789
|
+
* custom_id: 'a cool select menu',
|
|
634
790
|
* })
|
|
635
|
-
* .
|
|
636
|
-
* .setStyle(TextInputStyle.Paragraph);
|
|
791
|
+
* .setMinValues(1);
|
|
637
792
|
* ```
|
|
638
793
|
*/
|
|
639
|
-
constructor(data?: Partial<
|
|
640
|
-
/**
|
|
641
|
-
* Sets the custom id for this text input.
|
|
642
|
-
*
|
|
643
|
-
* @param customId - The custom id to use
|
|
644
|
-
*/
|
|
645
|
-
setCustomId(customId: string): this;
|
|
646
|
-
/**
|
|
647
|
-
* Sets the label for this text input.
|
|
648
|
-
*
|
|
649
|
-
* @param label - The label to use
|
|
650
|
-
*/
|
|
651
|
-
setLabel(label: string): this;
|
|
652
|
-
/**
|
|
653
|
-
* Sets the style for this text input.
|
|
654
|
-
*
|
|
655
|
-
* @param style - The style to use
|
|
656
|
-
*/
|
|
657
|
-
setStyle(style: TextInputStyle): this;
|
|
658
|
-
/**
|
|
659
|
-
* Sets the minimum length of text for this text input.
|
|
660
|
-
*
|
|
661
|
-
* @param minLength - The minimum length of text for this text input
|
|
662
|
-
*/
|
|
663
|
-
setMinLength(minLength: number): this;
|
|
664
|
-
/**
|
|
665
|
-
* Clears the minimum length of text for this text input.
|
|
666
|
-
*/
|
|
667
|
-
clearMinLength(): this;
|
|
668
|
-
/**
|
|
669
|
-
* Sets the maximum length of text for this text input.
|
|
670
|
-
*
|
|
671
|
-
* @param maxLength - The maximum length of text for this text input
|
|
672
|
-
*/
|
|
673
|
-
setMaxLength(maxLength: number): this;
|
|
674
|
-
/**
|
|
675
|
-
* Clears the maximum length of text for this text input.
|
|
676
|
-
*/
|
|
677
|
-
clearMaxLength(): this;
|
|
678
|
-
/**
|
|
679
|
-
* Sets the placeholder for this text input.
|
|
680
|
-
*
|
|
681
|
-
* @param placeholder - The placeholder to use
|
|
682
|
-
*/
|
|
683
|
-
setPlaceholder(placeholder: string): this;
|
|
684
|
-
/**
|
|
685
|
-
* Clears the placeholder for this text input.
|
|
686
|
-
*/
|
|
687
|
-
clearPlaceholder(): this;
|
|
794
|
+
constructor(data?: Partial<APIUserSelectComponent>);
|
|
688
795
|
/**
|
|
689
|
-
*
|
|
796
|
+
* Adds default users to this auto populated select menu.
|
|
690
797
|
*
|
|
691
|
-
* @param
|
|
692
|
-
*/
|
|
693
|
-
setValue(value: string): this;
|
|
694
|
-
/**
|
|
695
|
-
* Clears the value for this text input.
|
|
798
|
+
* @param users - The users to add
|
|
696
799
|
*/
|
|
697
|
-
|
|
800
|
+
addDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
698
801
|
/**
|
|
699
|
-
* Sets
|
|
802
|
+
* Sets default users for this auto populated select menu.
|
|
700
803
|
*
|
|
701
|
-
* @param
|
|
804
|
+
* @param users - The users to set
|
|
702
805
|
*/
|
|
703
|
-
|
|
806
|
+
setDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
704
807
|
/**
|
|
705
808
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
706
809
|
*/
|
|
707
|
-
toJSON(validationOverride?: boolean):
|
|
810
|
+
toJSON(validationOverride?: boolean): APIUserSelectComponent;
|
|
708
811
|
}
|
|
709
812
|
|
|
710
813
|
declare const textInputPredicate: z.ZodObject<{
|
|
711
814
|
type: z.ZodLiteral<ComponentType.TextInput>;
|
|
712
815
|
custom_id: z.ZodString;
|
|
713
|
-
label: z.ZodString;
|
|
714
816
|
style: z.ZodEnum<typeof TextInputStyle>;
|
|
715
817
|
min_length: z.ZodOptional<z.ZodNumber>;
|
|
716
818
|
max_length: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1295,7 +1397,7 @@ type MessageComponentBuilder = MessageActionRowComponentBuilder | MessageTopLeve
|
|
|
1295
1397
|
/**
|
|
1296
1398
|
* The builders that may be used for modals.
|
|
1297
1399
|
*/
|
|
1298
|
-
type ModalComponentBuilder = ActionRowBuilder | ModalActionRowComponentBuilder;
|
|
1400
|
+
type ModalComponentBuilder = ActionRowBuilder | LabelBuilder | ModalActionRowComponentBuilder;
|
|
1299
1401
|
/**
|
|
1300
1402
|
* Any button builder
|
|
1301
1403
|
*/
|
|
@@ -1376,6 +1478,10 @@ interface MappedComponentTypes {
|
|
|
1376
1478
|
* The container component type is associated with a {@link ContainerBuilder}.
|
|
1377
1479
|
*/
|
|
1378
1480
|
[ComponentType.Container]: ContainerBuilder;
|
|
1481
|
+
/**
|
|
1482
|
+
* The label component type is associated with a {@link LabelBuilder}.
|
|
1483
|
+
*/
|
|
1484
|
+
[ComponentType.Label]: LabelBuilder;
|
|
1379
1485
|
}
|
|
1380
1486
|
/**
|
|
1381
1487
|
* Factory for creating components from API data.
|
|
@@ -1393,7 +1499,7 @@ declare function createComponentBuilder<ComponentType extends keyof MappedCompon
|
|
|
1393
1499
|
* @param data - The API data to transform to a component class
|
|
1394
1500
|
*/
|
|
1395
1501
|
declare function createComponentBuilder<ComponentBuilder extends MessageComponentBuilder | ModalComponentBuilder>(data: ComponentBuilder): ComponentBuilder;
|
|
1396
|
-
declare function resolveAccessoryComponent(component: APISectionAccessoryComponent):
|
|
1502
|
+
declare function resolveAccessoryComponent(component: APISectionAccessoryComponent): ButtonBuilder | ThumbnailBuilder;
|
|
1397
1503
|
|
|
1398
1504
|
interface ActionRowBuilderData extends Partial<Omit<APIActionRowComponent<APIComponentInActionRow>, 'components'>> {
|
|
1399
1505
|
components: AnyActionRowComponentBuilder[];
|
|
@@ -2682,16 +2788,48 @@ declare class UserContextCommandBuilder extends ContextMenuCommandBuilder {
|
|
|
2682
2788
|
declare const modalPredicate: z.ZodObject<{
|
|
2683
2789
|
title: z.ZodString;
|
|
2684
2790
|
custom_id: z.ZodString;
|
|
2685
|
-
components: z.ZodArray<z.ZodObject<{
|
|
2791
|
+
components: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2686
2792
|
type: z.ZodLiteral<ComponentType.ActionRow>;
|
|
2687
2793
|
components: z.ZodArray<z.ZodObject<{
|
|
2688
2794
|
type: z.ZodLiteral<ComponentType.TextInput>;
|
|
2689
2795
|
}, z.core.$strip>>;
|
|
2690
|
-
}, z.core.$strip
|
|
2796
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2797
|
+
type: z.ZodLiteral<ComponentType.Label>;
|
|
2798
|
+
label: z.ZodString;
|
|
2799
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2800
|
+
component: z.ZodUnion<readonly [z.ZodObject<{
|
|
2801
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
2802
|
+
min_values: z.ZodOptional<z.ZodNumber>;
|
|
2803
|
+
max_values: z.ZodOptional<z.ZodNumber>;
|
|
2804
|
+
custom_id: z.ZodString;
|
|
2805
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
2806
|
+
type: z.ZodLiteral<ComponentType.StringSelect>;
|
|
2807
|
+
options: z.ZodArray<z.ZodObject<{
|
|
2808
|
+
label: z.ZodString;
|
|
2809
|
+
value: z.ZodString;
|
|
2810
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2811
|
+
emoji: z.ZodOptional<z.ZodObject<{
|
|
2812
|
+
id: z.ZodOptional<z.ZodString>;
|
|
2813
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2814
|
+
animated: z.ZodOptional<z.ZodBoolean>;
|
|
2815
|
+
}, z.core.$strict>>;
|
|
2816
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
2817
|
+
}, z.core.$strip>>;
|
|
2818
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2819
|
+
type: z.ZodLiteral<ComponentType.TextInput>;
|
|
2820
|
+
custom_id: z.ZodString;
|
|
2821
|
+
style: z.ZodEnum<typeof discord_api_types_v10.TextInputStyle>;
|
|
2822
|
+
min_length: z.ZodOptional<z.ZodNumber>;
|
|
2823
|
+
max_length: z.ZodOptional<z.ZodNumber>;
|
|
2824
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
2825
|
+
value: z.ZodOptional<z.ZodString>;
|
|
2826
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
2827
|
+
}, z.core.$strip>]>;
|
|
2828
|
+
}, z.core.$strip>]>>;
|
|
2691
2829
|
}, z.core.$strip>;
|
|
2692
2830
|
|
|
2693
2831
|
interface ModalBuilderData extends Partial<Omit<APIModalInteractionResponseCallbackData, 'components'>> {
|
|
2694
|
-
components: ActionRowBuilder[];
|
|
2832
|
+
components: (ActionRowBuilder | LabelBuilder)[];
|
|
2695
2833
|
}
|
|
2696
2834
|
/**
|
|
2697
2835
|
* A builder that creates API-compatible JSON data for modals.
|
|
@@ -2704,7 +2842,7 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
|
|
|
2704
2842
|
/**
|
|
2705
2843
|
* The components within this modal.
|
|
2706
2844
|
*/
|
|
2707
|
-
get components(): readonly ActionRowBuilder[];
|
|
2845
|
+
get components(): readonly (ActionRowBuilder | LabelBuilder)[];
|
|
2708
2846
|
/**
|
|
2709
2847
|
* Creates a new modal.
|
|
2710
2848
|
*
|
|
@@ -2724,47 +2862,47 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
|
|
|
2724
2862
|
*/
|
|
2725
2863
|
setCustomId(customId: string): this;
|
|
2726
2864
|
/**
|
|
2727
|
-
* Adds
|
|
2865
|
+
* Adds label components to this modal.
|
|
2728
2866
|
*
|
|
2729
2867
|
* @param components - The components to add
|
|
2730
2868
|
*/
|
|
2731
|
-
|
|
2869
|
+
addLabelComponents(...components: RestOrArray<APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder)>): this;
|
|
2732
2870
|
/**
|
|
2733
|
-
* Sets the
|
|
2871
|
+
* Sets the labels for this modal.
|
|
2734
2872
|
*
|
|
2735
2873
|
* @param components - The components to set
|
|
2736
2874
|
*/
|
|
2737
|
-
|
|
2875
|
+
setLabelComponents(...components: RestOrArray<APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder)>): this;
|
|
2738
2876
|
/**
|
|
2739
|
-
* Removes, replaces, or inserts
|
|
2877
|
+
* Removes, replaces, or inserts labels for this modal.
|
|
2740
2878
|
*
|
|
2741
2879
|
* @remarks
|
|
2742
2880
|
* This method behaves similarly
|
|
2743
2881
|
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
2744
|
-
* The maximum amount of
|
|
2882
|
+
* The maximum amount of labels that can be added is 5.
|
|
2745
2883
|
*
|
|
2746
|
-
* It's useful for modifying and adjusting order of the already-existing
|
|
2884
|
+
* It's useful for modifying and adjusting order of the already-existing labels of a modal.
|
|
2747
2885
|
* @example
|
|
2748
|
-
* Remove the first
|
|
2886
|
+
* Remove the first label:
|
|
2749
2887
|
* ```ts
|
|
2750
|
-
*
|
|
2888
|
+
* modal.spliceLabelComponents(0, 1);
|
|
2751
2889
|
* ```
|
|
2752
2890
|
* @example
|
|
2753
|
-
* Remove the first n
|
|
2891
|
+
* Remove the first n labels:
|
|
2754
2892
|
* ```ts
|
|
2755
2893
|
* const n = 4;
|
|
2756
|
-
*
|
|
2894
|
+
* modal.spliceLabelComponents(0, n);
|
|
2757
2895
|
* ```
|
|
2758
2896
|
* @example
|
|
2759
|
-
* Remove the last
|
|
2897
|
+
* Remove the last label:
|
|
2760
2898
|
* ```ts
|
|
2761
|
-
*
|
|
2899
|
+
* modal.spliceLabelComponents(-1, 1);
|
|
2762
2900
|
* ```
|
|
2763
2901
|
* @param index - The index to start at
|
|
2764
|
-
* @param deleteCount - The number of
|
|
2765
|
-
* @param
|
|
2902
|
+
* @param deleteCount - The number of labels to remove
|
|
2903
|
+
* @param labels - The replacing label objects
|
|
2766
2904
|
*/
|
|
2767
|
-
|
|
2905
|
+
spliceLabelComponents(index: number, deleteCount: number, ...labels: (APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder))[]): this;
|
|
2768
2906
|
/**
|
|
2769
2907
|
* Serializes this builder to API-compatible JSON data.
|
|
2770
2908
|
*
|
|
@@ -4261,4 +4399,4 @@ declare const localeMapPredicate: z.ZodObject<Record<Locale, z.ZodOptional<z.Zod
|
|
|
4261
4399
|
*/
|
|
4262
4400
|
declare const version: string;
|
|
4263
4401
|
|
|
4264
|
-
export { ActionRowBuilder, type ActionRowBuilderData, AllowedMentionsBuilder, type AnyActionRowComponentBuilder, type ApplicationCommandNumericOptionMinMaxValueData, ApplicationCommandNumericOptionMinMaxValueMixin, type ApplicationCommandOptionAllowedChannelType, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, type ApplicationCommandOptionBaseData, type ApplicationCommandOptionChannelTypesData, ApplicationCommandOptionChannelTypesMixin, type ApplicationCommandOptionWithAutocompleteData, ApplicationCommandOptionWithAutocompleteMixin, type ApplicationCommandOptionWithChoicesData, ApplicationCommandOptionWithChoicesMixin, AttachmentBuilder, type AutocompletableOptions, BaseButtonBuilder, BaseSelectMenuBuilder, type ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandAttachmentOption, ChatInputCommandBooleanOption, ChatInputCommandBuilder, ChatInputCommandChannelOption, ChatInputCommandIntegerOption, ChatInputCommandMentionableOption, ChatInputCommandNumberOption, ChatInputCommandRoleOption, ChatInputCommandStringOption, ChatInputCommandSubcommandBuilder, ChatInputCommandSubcommandGroupBuilder, type ChatInputCommandSubcommandGroupData, ChatInputCommandUserOption, CommandBuilder, type CommandData, ComponentBuilder, type ComponentBuilderBaseData, ContainerBuilder, type ContainerBuilderData, type ContainerComponentBuilders, ContextMenuCommandBuilder, type ContextMenuCommandType, CustomIdButtonBuilder, type CustomIdButtonStyle, DangerButtonBuilder, EmbedAuthorBuilder, EmbedBuilder, type EmbedBuilderData, EmbedFieldBuilder, EmbedFooterBuilder, type EmojiOrLabelButtonData, EmojiOrLabelButtonMixin, FileBuilder, LinkButtonBuilder, type MappedComponentTypes, MediaGalleryBuilder, type MediaGalleryBuilderData, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, MessageBuilder, type MessageBuilderData, type MessageComponentBuilder, MessageContextCommandBuilder, MessageReferenceBuilder, type MessageTopLevelComponentBuilder, type ModalActionRowComponentBuilder, ModalBuilder, type ModalBuilderData, type ModalComponentBuilder, PollAnswerBuilder, type PollAnswerData, PollAnswerMediaBuilder, PollBuilder, type PollData, PollMediaBuilder, PollQuestionBuilder, PremiumButtonBuilder, PrimaryButtonBuilder, type RestOrArray, RoleSelectMenuBuilder, SecondaryButtonBuilder, SectionBuilder, type SectionBuilderAccessory, type SectionBuilderData, SeparatorBuilder, SharedChatInputCommandOptions, type SharedChatInputCommandOptionsData, SharedChatInputCommandSubcommands, type SharedChatInputCommandSubcommandsData, SharedName, SharedNameAndDescription, type SharedNameAndDescriptionData, type SharedNameData, StringSelectMenuBuilder, type StringSelectMenuData, StringSelectMenuOptionBuilder, SuccessButtonBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserContextCommandBuilder, UserSelectMenuBuilder, ValidationError, actionRowPredicate, allowedMentionPredicate, attachmentPredicate, basicOptionPredicate, buttonPredicate, channelOptionPredicate, chatInputCommandPredicate, chatInputCommandSubcommandGroupPredicate, chatInputCommandSubcommandPredicate, containerPredicate, createComponentBuilder, customIdPredicate, disableValidators, embedAuthorPredicate, embedFieldPredicate, embedFooterPredicate, embedLength, embedPredicate, emojiPredicate, enableValidators, filePredicate, integerOptionPredicate, isValidationEnabled, localeMapPredicate, mediaGalleryItemPredicate, mediaGalleryPredicate, memberPermissionsPredicate, messageCommandPredicate, messagePredicate, messageReferencePredicate, modalPredicate, normalizeArray, numberOptionPredicate, pollAnswerMediaPredicate, pollAnswerPredicate, pollPredicate, pollQuestionPredicate, resolveAccessoryComponent, resolveBuilder, sectionPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, separatorPredicate, stringOptionPredicate, textDisplayPredicate, textInputPredicate, thumbnailPredicate, userCommandPredicate, version };
|
|
4402
|
+
export { ActionRowBuilder, type ActionRowBuilderData, AllowedMentionsBuilder, type AnyActionRowComponentBuilder, type ApplicationCommandNumericOptionMinMaxValueData, ApplicationCommandNumericOptionMinMaxValueMixin, type ApplicationCommandOptionAllowedChannelType, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, type ApplicationCommandOptionBaseData, type ApplicationCommandOptionChannelTypesData, ApplicationCommandOptionChannelTypesMixin, type ApplicationCommandOptionWithAutocompleteData, ApplicationCommandOptionWithAutocompleteMixin, type ApplicationCommandOptionWithChoicesData, ApplicationCommandOptionWithChoicesMixin, AttachmentBuilder, type AutocompletableOptions, BaseButtonBuilder, BaseSelectMenuBuilder, type ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandAttachmentOption, ChatInputCommandBooleanOption, ChatInputCommandBuilder, ChatInputCommandChannelOption, ChatInputCommandIntegerOption, ChatInputCommandMentionableOption, ChatInputCommandNumberOption, ChatInputCommandRoleOption, ChatInputCommandStringOption, ChatInputCommandSubcommandBuilder, ChatInputCommandSubcommandGroupBuilder, type ChatInputCommandSubcommandGroupData, ChatInputCommandUserOption, CommandBuilder, type CommandData, ComponentBuilder, type ComponentBuilderBaseData, ContainerBuilder, type ContainerBuilderData, type ContainerComponentBuilders, ContextMenuCommandBuilder, type ContextMenuCommandType, CustomIdButtonBuilder, type CustomIdButtonStyle, DangerButtonBuilder, EmbedAuthorBuilder, EmbedBuilder, type EmbedBuilderData, EmbedFieldBuilder, EmbedFooterBuilder, type EmojiOrLabelButtonData, EmojiOrLabelButtonMixin, FileBuilder, LabelBuilder, type LabelBuilderData, LinkButtonBuilder, type MappedComponentTypes, MediaGalleryBuilder, type MediaGalleryBuilderData, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, MessageBuilder, type MessageBuilderData, type MessageComponentBuilder, MessageContextCommandBuilder, MessageReferenceBuilder, type MessageTopLevelComponentBuilder, type ModalActionRowComponentBuilder, ModalBuilder, type ModalBuilderData, type ModalComponentBuilder, PollAnswerBuilder, type PollAnswerData, PollAnswerMediaBuilder, PollBuilder, type PollData, PollMediaBuilder, PollQuestionBuilder, PremiumButtonBuilder, PrimaryButtonBuilder, type RestOrArray, RoleSelectMenuBuilder, SecondaryButtonBuilder, SectionBuilder, type SectionBuilderAccessory, type SectionBuilderData, SeparatorBuilder, SharedChatInputCommandOptions, type SharedChatInputCommandOptionsData, SharedChatInputCommandSubcommands, type SharedChatInputCommandSubcommandsData, SharedName, SharedNameAndDescription, type SharedNameAndDescriptionData, type SharedNameData, StringSelectMenuBuilder, type StringSelectMenuData, StringSelectMenuOptionBuilder, SuccessButtonBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserContextCommandBuilder, UserSelectMenuBuilder, ValidationError, actionRowPredicate, allowedMentionPredicate, attachmentPredicate, basicOptionPredicate, buttonPredicate, channelOptionPredicate, chatInputCommandPredicate, chatInputCommandSubcommandGroupPredicate, chatInputCommandSubcommandPredicate, containerPredicate, createComponentBuilder, customIdPredicate, disableValidators, embedAuthorPredicate, embedFieldPredicate, embedFooterPredicate, embedLength, embedPredicate, emojiPredicate, enableValidators, filePredicate, integerOptionPredicate, isValidationEnabled, labelPredicate, localeMapPredicate, mediaGalleryItemPredicate, mediaGalleryPredicate, memberPermissionsPredicate, messageCommandPredicate, messagePredicate, messageReferencePredicate, modalPredicate, normalizeArray, numberOptionPredicate, pollAnswerMediaPredicate, pollAnswerPredicate, pollPredicate, pollQuestionPredicate, resolveAccessoryComponent, resolveBuilder, sectionPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, separatorPredicate, stringOptionPredicate, textDisplayPredicate, textInputPredicate, thumbnailPredicate, userCommandPredicate, version };
|